diff --git a/docs/api/admin-spec3-base.json b/docs/api/admin-spec3-base.json deleted file mode 100644 index 8cfc3c2283..0000000000 --- a/docs/api/admin-spec3-base.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "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`.", - "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.", - "x-resourceId": "OAuth" - }, - { - "name": "Batch Job", - "description": "Batch Job endpoints that allow handling batch jobs in Medusa.", - "x-resourceId": "batch_job" - }, - { - "name": "Claim", - "description": "Claim endpoints that allow handling claims in Medusa.", - "x-resourceId": "claim_order" - }, - { - "name": "Collection", - "description": "Collection endpoints that allow handling collections in Medusa.", - "x-resourceId": "product_collection" - }, - { - "name": "Customer", - "description": "Customer endpoints that allow handling customers in Medusa.", - "x-resourceId": "customer" - }, - { - "name": "Customer Group", - "description": "Customer Group endpoints that allow handling customer groups in Medusa.", - "x-resourceId": "customer_group" - }, - { - "name": "Discount", - "description": "Discount endpoints that allow handling discounts in Medusa.", - "x-resourceId": "discount" - }, - { - "name": "Discount Condition", - "description": "Discount Condition endpoints that allow handling discount conditions in Medusa.", - "x-resourceId": "discount_condition" - }, - { - "name": "Draft Order", - "description": "Draft Order endpoints that allow handling draft orders in Medusa.", - "x-resourceId": "draft-order" - }, - { - "name": "Gift Card", - "description": "Gift Card endpoints that allow handling gift cards in Medusa.", - "x-resourceId": "gift_card" - }, - { - "name": "Invite", - "description": "Invite endpoints that allow handling invites in Medusa.", - "x-resourceId": "invite" - }, - { - "name": "Note", - "description": "Note endpoints that allow handling notes in Medusa.", - "x-resourceId": "note" - }, - { - "name": "Notification", - "description": "Notification endpoints that allow handling notifications in Medusa.", - "x-resourceId": "notification" - }, - { - "name": "Order", - "description": "Order endpoints that allow handling orders in Medusa.", - "x-resourceId": "order" - }, - { - "name": "Price List", - "description": "Price List endpoints that allow handling price lists in Medusa.", - "x-resourceId": "price_list" - }, - { - "name": "Product", - "description": "Product endpoints that allow handling products in Medusa.", - "x-resourceId": "product" - }, - { - "name": "Product Tag", - "description": "Product Tag endpoints that allow handling product tags in Medusa.", - "x-resourceId": "product_tag" - }, - { - "name": "Product Types", - "description": "Product Types endpoints that allow handling product types in Medusa.", - "x-resourceId": "product_type" - }, - { - "name": "Product Variant", - "description": "Product Variant endpoints that allow handling product variants in Medusa.", - "x-resourceId": "product_variant" - }, - { - "name": "Region", - "description": "Region endpoints that allow handling regions in Medusa.", - "x-resourceId": "region" - }, - { - "name": "Return Reason", - "description": "Return Reason endpoints that allow handling return reasons in Medusa.", - "x-resourceId": "return_reason" - }, - { - "name": "Return", - "description": "Return endpoints that allow handling returns in Medusa.", - "x-resourceId": "return" - }, - { - "name": "Sales Channel", - "description": "Sales Channel endpoints that allow handling sales channels in Medusa.", - "x-resourceId": "sales_channel" - }, - { - "name": "Shipping Option", - "description": "Shipping Option endpoints that allow handling shipping options in Medusa.", - "x-resourceId": "shipping_option" - }, - { - "name": "Shipping Profile", - "description": "Shipping Profile endpoints that allow handling shipping profiles in Medusa.", - "x-resourceId": "shipping_profile" - }, - { - "name": "Store", - "description": "Store endpoints that allow handling stores in Medusa.", - "x-resourceId": "store" - }, - { - "name": "Swap", - "description": "Swap endpoints that allow handling swaps in Medusa.", - "x-resourceId": "swap" - }, - { - "name": "Tax Rate", - "description": "Tax Rate endpoints that allow handling tax rates in Medusa.", - "x-resourceId": "tax_rate" - }, - { - "name": "Upload", - "description": "Upload endpoints that allow handling uploads in Medusa." - }, - { - "name": "User", - "description": "User endpoints that allow handling users in Medusa.", - "x-resourceId": "user" - } - ], - "servers": [ - { - "url": "https://api.medusa-commerce.com/admin" - } - ], - "paths": {} -} diff --git a/docs/api/admin-spec3-base.yaml b/docs/api/admin-spec3-base.yaml new file mode 100644 index 0000000000..1c7dabb2b2 --- /dev/null +++ b/docs/api/admin-spec3-base.yaml @@ -0,0 +1,321 @@ +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. + + + 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. + x-resourceId: OAuth +- name: Batch Job + description: Batch Job endpoints that allow handling batch jobs in Medusa. + x-resourceId: batch_job +- name: Claim + description: Claim endpoints that allow handling claims in Medusa. + x-resourceId: claim_order +- name: Collection + description: Collection endpoints that allow handling collections in Medusa. + x-resourceId: product_collection +- name: Customer + description: Customer endpoints that allow handling customers in Medusa. + x-resourceId: customer +- name: Customer Group + description: Customer Group endpoints that allow handling customer groups in Medusa. + x-resourceId: customer_group +- name: Discount + description: Discount endpoints that allow handling discounts in Medusa. + x-resourceId: discount +- name: Discount Condition + description: Discount Condition endpoints that allow handling discount conditions + in Medusa. + x-resourceId: discount_condition +- name: Draft Order + description: Draft Order endpoints that allow handling draft orders in Medusa. + x-resourceId: draft-order +- name: Gift Card + description: Gift Card endpoints that allow handling gift cards in Medusa. + x-resourceId: gift_card +- name: Invite + description: Invite endpoints that allow handling invites in Medusa. + x-resourceId: invite +- name: Note + description: Note endpoints that allow handling notes in Medusa. + x-resourceId: note +- name: Notification + description: Notification endpoints that allow handling notifications in Medusa. + x-resourceId: notification +- name: Order + description: Order endpoints that allow handling orders in Medusa. + x-resourceId: order +- name: Price List + description: Price List endpoints that allow handling price lists in Medusa. + x-resourceId: price_list +- name: Product + description: Product endpoints that allow handling products in Medusa. + x-resourceId: product +- name: Product Tag + description: Product Tag endpoints that allow handling product tags in Medusa. + x-resourceId: product_tag +- name: Product Type + description: Product Types endpoints that allow handling product types in Medusa. + x-resourceId: product_type +- name: Product Variant + description: Product Variant endpoints that allow handling product variants in Medusa. + x-resourceId: product_variant +- name: Region + description: Region endpoints that allow handling regions in Medusa. + x-resourceId: region +- name: Return Reason + description: Return Reason endpoints that allow handling return reasons in Medusa. + x-resourceId: return_reason +- name: Return + description: Return endpoints that allow handling returns in Medusa. + x-resourceId: return +- name: Sales Channel + description: Sales Channel endpoints that allow handling sales channels in Medusa. + x-resourceId: sales_channel +- name: Shipping Option + description: Shipping Option endpoints that allow handling shipping options in Medusa. + x-resourceId: shipping_option +- name: Shipping Profile + description: Shipping Profile endpoints that allow handling shipping profiles in + Medusa. + x-resourceId: shipping_profile +- name: Store + description: Store endpoints that allow handling stores in Medusa. + x-resourceId: store +- name: Swap + description: Swap endpoints that allow handling swaps in Medusa. + x-resourceId: swap +- name: Tax Rate + description: Tax Rate endpoints that allow handling tax rates in Medusa. + x-resourceId: tax_rate +- name: Upload + description: Upload endpoints that allow handling uploads in Medusa. +- name: User + description: User endpoints that allow handling users in Medusa. + x-resourceId: user +servers: +- url: https://api.medusa-commerce.com/admin +paths: {} +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/multiple_errors" + examples: + not_allowed: + $ref: "#/components/examples/not_allowed_error" + invalid_data: + $ref: "#/components/examples/invalid_data_error" + multiple_errors: + $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 -U + UPDATE public.user SET api_token='' WHERE email=''; + ``` + + Where: + - `` is the name of the database schema you use for the Medusa server. + - `` is the name of the user that has privileges over the database schema. + - `` is the API token you want to associate with the user. You can use [this tool to generate a random token](https://randomkeygen.com/). + - `` 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 alternatively following along with the JS Client request samples, you must provide the `apiKey` option when creating the Medusa client: + + ```js + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3, 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. \ No newline at end of file diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index df4b076b46..f9a5e5d76a 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -1,20134 +1,23325 @@ -{ - "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`.", - "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.", - "x-resourceId": "OAuth" - }, - { - "name": "Batch Job", - "description": "Batch Job endpoints that allow handling batch jobs in Medusa.", - "x-resourceId": "batch_job" - }, - { - "name": "Claim", - "description": "Claim endpoints that allow handling claims in Medusa.", - "x-resourceId": "claim_order" - }, - { - "name": "Collection", - "description": "Collection endpoints that allow handling collections in Medusa.", - "x-resourceId": "product_collection" - }, - { - "name": "Customer", - "description": "Customer endpoints that allow handling customers in Medusa.", - "x-resourceId": "customer" - }, - { - "name": "Customer Group", - "description": "Customer Group endpoints that allow handling customer groups in Medusa.", - "x-resourceId": "customer_group" - }, - { - "name": "Discount", - "description": "Discount endpoints that allow handling discounts in Medusa.", - "x-resourceId": "discount" - }, - { - "name": "Discount Condition", - "description": "Discount Condition endpoints that allow handling discount conditions in Medusa.", - "x-resourceId": "discount_condition" - }, - { - "name": "Draft Order", - "description": "Draft Order endpoints that allow handling draft orders in Medusa.", - "x-resourceId": "draft-order" - }, - { - "name": "Gift Card", - "description": "Gift Card endpoints that allow handling gift cards in Medusa.", - "x-resourceId": "gift_card" - }, - { - "name": "Invite", - "description": "Invite endpoints that allow handling invites in Medusa.", - "x-resourceId": "invite" - }, - { - "name": "Note", - "description": "Note endpoints that allow handling notes in Medusa.", - "x-resourceId": "note" - }, - { - "name": "Notification", - "description": "Notification endpoints that allow handling notifications in Medusa.", - "x-resourceId": "notification" - }, - { - "name": "Order", - "description": "Order endpoints that allow handling orders in Medusa.", - "x-resourceId": "order" - }, - { - "name": "Price List", - "description": "Price List endpoints that allow handling price lists in Medusa.", - "x-resourceId": "price_list" - }, - { - "name": "Product", - "description": "Product endpoints that allow handling products in Medusa.", - "x-resourceId": "product" - }, - { - "name": "Product Tag", - "description": "Product Tag endpoints that allow handling product tags in Medusa.", - "x-resourceId": "product_tag" - }, - { - "name": "Product Types", - "description": "Product Types endpoints that allow handling product types in Medusa.", - "x-resourceId": "product_type" - }, - { - "name": "Product Variant", - "description": "Product Variant endpoints that allow handling product variants in Medusa.", - "x-resourceId": "product_variant" - }, - { - "name": "Region", - "description": "Region endpoints that allow handling regions in Medusa.", - "x-resourceId": "region" - }, - { - "name": "Return Reason", - "description": "Return Reason endpoints that allow handling return reasons in Medusa.", - "x-resourceId": "return_reason" - }, - { - "name": "Return", - "description": "Return endpoints that allow handling returns in Medusa.", - "x-resourceId": "return" - }, - { - "name": "Sales Channel", - "description": "Sales Channel endpoints that allow handling sales channels in Medusa.", - "x-resourceId": "sales_channel" - }, - { - "name": "Shipping Option", - "description": "Shipping Option endpoints that allow handling shipping options in Medusa.", - "x-resourceId": "shipping_option" - }, - { - "name": "Shipping Profile", - "description": "Shipping Profile endpoints that allow handling shipping profiles in Medusa.", - "x-resourceId": "shipping_profile" - }, - { - "name": "Store", - "description": "Store endpoints that allow handling stores in Medusa.", - "x-resourceId": "store" - }, - { - "name": "Swap", - "description": "Swap endpoints that allow handling swaps in Medusa.", - "x-resourceId": "swap" - }, - { - "name": "Tax Rate", - "description": "Tax Rate endpoints that allow handling tax rates in Medusa.", - "x-resourceId": "tax_rate" - }, - { - "name": "Upload", - "description": "Upload endpoints that allow handling uploads in Medusa." - }, - { - "name": "User", - "description": "User endpoints that allow handling users in Medusa.", - "x-resourceId": "user" - } - ], - "servers": [ - { - "url": "https://api.medusa-commerce.com/admin" - } - ], - "paths": { - "/apps/authorizations": { - "post": { - "operationId": "PostApps", - "summary": "Generates a token for an application.", - "description": "Generates a token for an application.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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." - } - } - } - } - } - }, - "tags": [ - "App" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "apps": { - "$ref": "#/components/schemas/OAuth" - } - } - } - } - } - } - } - } - }, - "/apps": { - "get": { - "operationId": "GetApps", - "summary": "List applications", - "description": "Retrieve a list of applications.", - "x-authenticated": true, - "tags": [ - "App" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "apps": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OAuth" - } - } - } - } - } - } - } - } - } - }, - "/auth": { - "post": { - "operationId": "PostAuth", - "summary": "Authenticate a User", - "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." - } - } - } - } - } - }, - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - }, - "401": { - "description": "The user doesn't exist or the credentials are incorrect." - } - } - }, - "delete": { - "operationId": "DeleteAuth", - "summary": "Delete Session", - "x-authenticated": true, - "description": "Deletes the current session for the logged in user.", - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK" - } - } - }, - "get": { - "operationId": "GetAuth", - "summary": "Get Session", - "x-authenticated": true, - "description": "Gets the currently logged in User.", - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - }, - "400": { - "description": "An error occurred." - } - } - } - }, - "/batch-jobs/{id}/cancel": { - "post": { - "operationId": "PostBatchJobsBatchJobCancel", - "summary": "Marks a batch job as canceled", - "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" - } - } - ], - "tags": [ - "Batch Job" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "batch_job": { - "$ref": "#/components/schemas/batch_job" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Batch Job" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "batch_job": { - "$ref": "#/components/schemas/batch_job" - } - } - } - } - } - } - } - } - }, - "/batch-jobs": { - "post": { - "operationId": "PostBatchJobs", - "summary": "Create a Batch Job", - "description": "Creates a Batch Job.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - }, - "tags": [ - "Batch Job" - ], - "responses": { - "201": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "batch_job": { - "$ref": "#/components/schemas/batch_job" - } - } - } - } - } - } - } - }, - "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": [ +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. + + + + 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. + x-resourceId: OAuth + - name: Batch Job + description: Batch Job endpoints that allow handling batch jobs in Medusa. + x-resourceId: batch_job + - name: Claim + description: Claim endpoints that allow handling claims in Medusa. + x-resourceId: claim_order + - name: Collection + description: Collection endpoints that allow handling collections in Medusa. + x-resourceId: product_collection + - name: Customer + description: Customer endpoints that allow handling customers in Medusa. + x-resourceId: customer + - name: Customer Group + description: Customer Group endpoints that allow handling customer groups in Medusa. + x-resourceId: customer_group + - name: Discount + description: Discount endpoints that allow handling discounts in Medusa. + x-resourceId: discount + - name: Discount Condition + description: >- + Discount Condition endpoints that allow handling discount conditions in + Medusa. + x-resourceId: discount_condition + - name: Draft Order + description: Draft Order endpoints that allow handling draft orders in Medusa. + x-resourceId: draft-order + - name: Gift Card + description: Gift Card endpoints that allow handling gift cards in Medusa. + x-resourceId: gift_card + - name: Invite + description: Invite endpoints that allow handling invites in Medusa. + x-resourceId: invite + - name: Note + description: Note endpoints that allow handling notes in Medusa. + x-resourceId: note + - name: Notification + description: Notification endpoints that allow handling notifications in Medusa. + x-resourceId: notification + - name: Order + description: Order endpoints that allow handling orders in Medusa. + x-resourceId: order + - name: Price List + description: Price List endpoints that allow handling price lists in Medusa. + x-resourceId: price_list + - name: Product + description: Product endpoints that allow handling products in Medusa. + x-resourceId: product + - name: Product Tag + description: Product Tag endpoints that allow handling product tags in Medusa. + x-resourceId: product_tag + - name: Product Type + description: Product Types endpoints that allow handling product types in Medusa. + x-resourceId: product_type + - name: Product Variant + description: Product Variant endpoints that allow handling product variants in Medusa. + x-resourceId: product_variant + - name: Region + description: Region endpoints that allow handling regions in Medusa. + x-resourceId: region + - name: Return Reason + description: Return Reason endpoints that allow handling return reasons in Medusa. + x-resourceId: return_reason + - name: Return + description: Return endpoints that allow handling returns in Medusa. + x-resourceId: return + - name: Sales Channel + description: Sales Channel endpoints that allow handling sales channels in Medusa. + x-resourceId: sales_channel + - name: Shipping Option + description: Shipping Option endpoints that allow handling shipping options in Medusa. + x-resourceId: shipping_option + - name: Shipping Profile + description: >- + Shipping Profile endpoints that allow handling shipping profiles in + Medusa. + x-resourceId: shipping_profile + - name: Store + description: Store endpoints that allow handling stores in Medusa. + x-resourceId: store + - name: Swap + description: Swap endpoints that allow handling swaps in Medusa. + x-resourceId: swap + - name: Tax Rate + description: Tax Rate endpoints that allow handling tax rates in Medusa. + x-resourceId: tax_rate + - name: Upload + description: Upload endpoints that allow handling uploads in Medusa. + - name: User + description: User endpoints that allow handling users in Medusa. + x-resourceId: user +servers: + - url: 'https://api.medusa-commerce.com/admin' +paths: + /apps/authorizations: + post: + operationId: PostApps + summary: Generates a token for an application. + description: Generates a token for an application. + x-authenticated: true + requestBody: + content: + application/json: + schema: + 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. + 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: + properties: + apps: + $ref: '#/components/schemas/OAuth' + '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-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: + properties: + apps: + type: array + items: + $ref: '#/components/schemas/OAuth' + '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: Authenticate a User + 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-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: + properties: + user: + $ref: '#/components/schemas/user' + '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: Delete Session + x-authenticated: true + description: Deletes the current session for the logged in user. + 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 Session + x-authenticated: true + description: Gets the currently logged in User. + 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: + properties: + user: + $ref: '#/components/schemas/user' + '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: Marks a batch job as canceled + 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-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: + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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-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: + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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: + 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 + 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: + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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-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: + properties: + batch_jobs: + type: array + items: + $ref: '#/components/schemas/batch_job' + 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 + '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: Retrieve 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-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: + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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: Updates products associated with a Product Collection + 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: + 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 + 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: + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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: Removes products associated with a Product Collection + 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: + 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 + 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: + 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 + '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 Product Collection + description: Creates a Product Collection. + x-authenticated: true + requestBody: + content: + application/json: + schema: + 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 + 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: + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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 Product 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: 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-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: + properties: + collections: + type: array + items: + $ref: '#/components/schemas/product_collection' + 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 + '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 Product 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-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: + 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 + '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: Retrieve a Product 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-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: + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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 Product 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: + 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 + 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: + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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/batch': + post: + operationId: PostCustomerGroupsGroupCustomersBatch + summary: 'Add a list of customers to a customer group ' + 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: + required: + - customer_ids + properties: + customer_ids: + description: The ids of the customers to add + type: array + items: + required: + - id + properties: + id: + description: ID of the customer + 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.customerGroups.addCustomers(customer_group_id, { + customer_ids: [ { - "type": "string", - "description": "batch job ID" - }, - { - "type": "array", - "description": "multiple batch job IDs", - "items": { - "type": "string" - } + id: customer_id } ] - } - }, - { - "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" - } - } - } - } - ], - "tags": [ - "Batch Job" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "batch_jobs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/batch_job" - } - }, - "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" + }) + + .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" } - } - } - } - } - } - } - } - }, - "/batch-jobs/{id}": { - "get": { - "operationId": "GetBatchJobsBatchJob", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Batch Job" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "batch_job": { - "$ref": "#/components/schemas/batch_job" - } - } - } - } - } - } - } - } - }, - "/collections/{id}/products/batch": { - "post": { - "operationId": "PostProductsToCollection", - "summary": "Updates products associated with a Product Collection", - "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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteProductsFromCollection", - "summary": "Removes products associated with a Product Collection", - "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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - } - }, - "/collections": { - "post": { - "operationId": "PostCollections", - "summary": "Create a Product Collection", - "description": "Creates a Product Collection.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCollections", - "summary": "List Product 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": "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" - } - } - } - } - ], - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collections": { - "type": "array", - "items": { - "$ref": "#/components/schemas/product_collection" - } - }, - "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" - } - } - } - } - } - } - } - } - }, - "/collections/{id}": { - "delete": { - "operationId": "DeleteCollectionsCollection", - "summary": "Delete a Product 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" - } - } - ], - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCollectionsCollection", - "summary": "Retrieve a Product 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" - } - } - ], - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCollectionsCollection", - "summary": "Update a Product 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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - } - }, - "/customer-groups/{id}/customers/batch": { - "post": { - "operationId": "PostCustomerGroupsGroupCustomersBatch", - "summary": "Add a list of customers to a customer group ", - "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": { - "required": [ - "customer_ids" - ], - "properties": { - "customer_ids": { - "description": "The ids of the customers to add", - "type": "array", - "items": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "ID of the customer", - "type": "string" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteCustomerGroupsGroupCustomerBatch", - "summary": "Remove a list of customers from a customer group ", - "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": { - "required": [ - "customer_ids" - ], - "properties": { - "customer_ids": { - "description": "The ids of the customers to remove", - "type": "array", - "items": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "ID of the customer", - "type": "string" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - } - }, - "/customer-groups": { - "post": { - "operationId": "PostCustomerGroups", - "summary": "Create a CustomerGroup", - "description": "Creates a CustomerGroup.", - "x-authenticated": true, - "parameters": [], - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the customer group" - }, - "metadata": { - "type": "object", - "description": "Metadata for the customer." - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCustomerGroups", - "summary": "Retrieve a list of 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": "id", - "style": "form", - "explode": false, - "description": "Filter by the customer group ID", - "schema": { - "oneOf": [ + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: '#/components/schemas/customer_group' + '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 a list of customers from a customer group ' + 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: + required: + - customer_ids + properties: + customer_ids: + description: The ids of the customers to remove + type: array + items: + required: + - id + properties: + id: + description: ID of the customer + 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.customerGroups.removeCustomers(customer_group_id, { + customer_ids: [ { - "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" - } - } + id: customer_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" - } - } - ], - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_groups": { - "type": "array", - "items": { - "$ref": "#/components/schemas/customer_group" - } - }, - "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" + }) + + .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" } - } - } - } - } - } - } - } - }, - "/customer-groups/{id}": { - "delete": { - "operationId": "DeleteCustomerGroupsCustomerGroup", - "summary": "Delete a CustomerGroup", - "description": "Deletes a CustomerGroup.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The ID of the Customer Group", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCustomerGroupsGroup", - "summary": "Retrieve a CustomerGroup", - "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" - } - } - ], - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCustomerGroupsGroup", - "summary": "Update a CustomerGroup", - "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": { - "properties": { - "name": { - "description": "Name of the customer group", - "type": "string" - }, - "metadata": { - "description": "Metadata for the customer.", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Customer Group" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/customers": { - "post": { - "operationId": "PostCustomers", - "summary": "Create a Customer", - "description": "Creates a Customer.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "201": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - }, - "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" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/customers/{id}": { - "get": { - "operationId": "GetCustomersCustomer", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - }, - "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": { - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/discounts/{id}/regions/{region_id}": { - "post": { - "operationId": "PostDiscountsDiscountRegionsRegion", - "summary": "Adds Region availability", - "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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteDiscountsDiscountRegionsRegion", - "summary": "Remove Region availability", - "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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - } - }, - "/discounts/{discount_id}/conditions": { - "post": { - "operationId": "PostDiscountsDiscountConditions", - "summary": "Create a DiscountCondition", - "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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Discount Condition" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - } - }, - "/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 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": { - "required": [ - "code", - "rule" - ], - "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" - } - } - } - } - } - }, - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - }, - "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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/discounts/{id}/dynamic-codes": { - "post": { - "operationId": "PostDiscountsDiscountDynamicCodes", - "summary": "Create a dynamic Discount code", - "description": "Creates a 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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "code" - ], - "properties": { - "code": { - "type": "string", - "description": "The unique code that will be used to redeem the Discount." - }, - "usage_limit": { - "type": "number", - "default": "1", - "description": "amount of times the discount can be applied." - }, - "metadata": { - "type": "object", - "description": "An optional set of key-value paris to hold additional information." - } - } - } - } - } - } - } - }, - "/discounts/{discount_id}/conditions/{condition_id}": { - "delete": { - "operationId": "DeleteDiscountsDiscountConditionsCondition", - "summary": "Delete a DiscountCondition", - "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" - } - } - ], - "tags": [ - "Discount Condition" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetDiscountsDiscountConditionsCondition", - "summary": "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" - } - } - ], - "description": "Gets a DiscountCondition", - "tags": [ - "Discount Condition" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount_condition": { - "$ref": "#/components/schemas/discount_condition" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostDiscountsDiscountConditionsCondition", - "summary": "Update a DiscountCondition", - "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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetDiscountsDiscount", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - }, - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - } - }, - "/discounts/code/{code}": { - "get": { - "operationId": "GetDiscountsDiscountCode", - "summary": "Retrieve a 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" - } - } - ], - "tags": [ - "Discount" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "discount": { - "$ref": "#/components/schemas/discount" - } - } - } - } - } - } - } - } - }, - "/draft-orders": { - "post": { - "operationId": "PostDraftOrders", - "summary": "Create a Draft Order", - "description": "Creates a Draft Order", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "email", - "items", - "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.", - "$ref": "#/components/schemas/address" - }, - "shipping_address": { - "description": "The Address to be used for shipping.", - "$ref": "#/components/schemas/address" - }, - "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" - } - } - } - } - } - }, - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "draft_order": { - "$ref": "#/components/schemas/draft-order" - } - } - } - } - } - } - } - }, - "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" - } - } - ], - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "draft_orders": { - "type": "array", - "items": { - "$ref": "#/components/schemas/draft-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" - } - } - } - } - } - } - } - } - }, - "/draft-orders/{id}/line-items": { - "post": { - "operationId": "PostDraftOrdersDraftOrderLineItems", - "summary": "Create a Line Item for Draft Order", - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "draft_order": { - "$ref": "#/components/schemas/draft-order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetDraftOrdersDraftOrder", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "draft_order": { - "$ref": "#/components/schemas/draft-order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "draft_order": { - "$ref": "#/components/schemas/draft-order" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostDraftOrdersDraftOrderLineItemsItem", - "summary": "Update a Line Item for a Draft Order", - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "draft_order": { - "$ref": "#/components/schemas/draft-order" - } - } - } - } - } - } - } - } - }, - "/draft-orders/{id}/pay": { - "post": { - "summary": "Registers a payment for a Draft Order", - "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" - } - } - ], - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/draft-order" - } - } - } - } - } - } - } - } - }, - "/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": { - "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.", - "$ref": "#/components/schemas/address" - }, - "shipping_address": { - "description": "The Address to be used for shipping.", - "$ref": "#/components/schemas/address" - }, - "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" - } - } - } - } - } - }, - "tags": [ - "Draft Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "draft_order": { - "$ref": "#/components/schemas/draft-order" - } - } - } - } - } - } - } - } - }, - "/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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Gift Card" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "gift_card": { - "$ref": "#/components/schemas/gift_card" - } - } - } - } - } - } - } - }, - "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" - } - } - ], - "tags": [ - "Gift Card" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "gift_cards": { - "type": "array", - "items": { - "$ref": "#/components/schemas/gift_card" - } - }, - "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" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Gift Card" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetGiftCardsGiftCard", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Gift Card" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "gift_card": { - "$ref": "#/components/schemas/gift_card" - } - } - } - } - } - } - } - }, - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Gift Card" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "gift_card": { - "$ref": "#/components/schemas/gift_card" - } - } - } - } - } - } - } - } - }, - "/invites/accept": { - "post": { - "operationId": "PostInvitesInviteAccept", - "summary": "Accept an Invite", - "description": "Accepts an Invite and creates a corresponding user", - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - }, - "tags": [ - "Invite" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/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": { - "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" - ] - } - } - } - } - } - }, - "tags": [ - "Invite" - ], - "responses": { - "200": { - "description": "OK" - } - } - }, - "get": { - "operationId": "GetInvites", - "summary": "Lists all Invites", - "description": "Lists all Invites", - "x-authenticated": true, - "tags": [ - "Invite" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "invites": { - "type": "array", - "items": { - "$ref": "#/components/schemas/invite" - } - } - } - } - } - } - } - } - } - }, - "/invites/{invite_id}": { - "delete": { - "operationId": "DeleteInvitesInvite", - "summary": "Create an Invite", - "description": "Creates an Invite and triggers an 'invite' created event", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "invite_id", - "required": true, - "description": "The ID of the Invite", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Invite" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "id": { - "type": "string", - "description": "The ID of the deleted Invite." - }, - "object": { - "type": "string", - "description": "The type of the object that was deleted.", - "format": "invite" - }, - "deleted": { - "type": "boolean", - "description": "Whether or not the Invite was deleted.", - "default": true - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Invite" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/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": { - "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." - } - } - } - } - } - }, - "tags": [ - "Note" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "note": { - "$ref": "#/components/schemas/note" - } - } - } - } - } - } - } - }, - "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" - } - } - ], - "tags": [ - "Note" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/notes/{id}": { - "delete": { - "operationId": "DeleteNotesNote", - "summary": "Deletes 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" - } - } - ], - "tags": [ - "Note" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetNotesNote", - "summary": "Get 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" - } - } - ], - "tags": [ - "Note" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "note": { - "$ref": "#/components/schemas/note" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostNotesNote", - "summary": "Updates 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": { - "required": [ - "value" - ], - "properties": { - "value": { - "type": "string", - "description": "The updated description of the Note." - } - } - } - } - } - }, - "tags": [ - "Note" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "note": { - "$ref": "#/components/schemas/note" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Notification" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "notifications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/notification" - } - } - } - } - } - } - } - } - } - }, - "/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": { - "properties": { - "to": { - "description": "A new address or user identifier that the Notification should be sent to", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Notification" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "notification": { - "$ref": "#/components/schemas/notification" - } - } - } - } - } - } - } - } - }, - "/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.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The ID of the Order.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "price", - "option_id" - ], - "properties": { - "price": { - "type": "integer", - "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." - }, - "data": { - "type": "object", - "description": "The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider." - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}/claims/{claim_id}/cancel": { - "post": { - "operationId": "PostOrdersClaimCancel", - "summary": "Cancels 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" - } - } - ], - "tags": [ - "Claim" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel": { - "post": { - "operationId": "PostOrdersClaimFulfillmentsCancel", - "summary": "Cancels a fulfilmment related to a Claim", - "description": "Registers a 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" - } - } - ], - "tags": [ - "Fulfillment" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel": { - "post": { - "operationId": "PostOrdersSwapFulfillmentsCancel", - "summary": "Cancels a fulfilmment related to a Swap", - "description": "Registers a 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" - } - } - ], - "tags": [ - "Fulfillment" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Fulfillment" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}/capture": { - "post": { - "operationId": "PostOrdersOrderCapture", - "summary": "Capture an Order", - "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" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Claim" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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": { - "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": { - "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": { - "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" - } - } - } - }, - "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" - } - } - } - } - } - }, - "tags": [ - "Claim" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "items" - ], - "properties": { - "items": { - "description": "The Line Items to include in the Fulfillment.", - "type": "array", - "items": { - "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" - } - } - } - } - } - }, - "tags": [ - "Fulfillment" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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 Claim.", - "type": "boolean" - } - } - } - } - } - }, - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "return_items" - ], - "properties": { - "return_items": { - "description": "The Line Items to return as part of the Swap.", - "type": "array", - "items": { - "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": { - "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": { - "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 - } - } - } - } - } - }, - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}/claims/{claim_id}/fulfillments": { - "post": { - "operationId": "PostOrdersOrderClaimsClaimFulfillments", - "summary": "Create a 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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Fulfillment" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}/swaps/{swap_id}/fulfillments": { - "post": { - "operationId": "PostOrdersOrderSwapsSwapFulfillments", - "summary": "Create a 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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Fulfillment" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}": { - "get": { - "operationId": "GetOrdersOrder", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - }, - "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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "email": { - "description": "the email for the order", - "type": "string" - }, - "billing_address": { - "description": "Billing address", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "shipping_address": { - "description": "Shipping address", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "items": { - "description": "The Line Items for the order", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "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/line_item" - }, - "description": "Items to ship" - } - } - }, - "no_notification": { - "description": "A flag to indicate if no notifications should be emitted related to the updated order.", - "type": "boolean" - } - } - } - } - } - }, - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: '#/components/schemas/customer_group' + '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 CustomerGroup + description: Creates a CustomerGroup. + x-authenticated: true + parameters: [] + 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: + properties: + customer_group: + $ref: '#/components/schemas/customer_group' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + description: Name of the customer group + metadata: + type: object + description: Metadata for the customer. + get: + operationId: GetCustomerGroups + summary: Retrieve a list of 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: 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-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.id); + }); + - 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: + properties: + customer_groups: + type: array + items: + $ref: '#/components/schemas/customer_group' + 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 + '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 CustomerGroup + 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-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: + 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 + '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: Retrieve a CustomerGroup + 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-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: + properties: + customer_group: + $ref: '#/components/schemas/customer_group' + '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 CustomerGroup + 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: + properties: + name: + description: Name of the customer group + type: string + metadata: + description: Metadata for the customer. + type: object + 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: + properties: + customer_group: + $ref: '#/components/schemas/customer_group' + '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 + 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: + 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 + '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: + 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 + tags: + - Customer + 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: [] + responses: + '201': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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-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: + 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 + '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: Retrieve 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-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: + properties: + customer: + $ref: '#/components/schemas/customer' + '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: + 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: + 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 + 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: + properties: + customer: + $ref: '#/components/schemas/customer' + '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: Adds Region availability + 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-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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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 availability + 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-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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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 DiscountCondition + 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: + 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 + 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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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 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: + required: + - code + - rule + 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 + 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 + }, + 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" + } + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: '#/components/schemas/discount' + '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-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: + 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 + '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 Discount code + description: >- + Creates a 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 + 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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - code + properties: + code: + type: string + description: The unique code that will be used to redeem the Discount. + usage_limit: + type: number + default: '1' + description: amount of times the discount can be applied. + metadata: + type: object + description: >- + An optional set of key-value paris to hold additional + information. + '/discounts/{discount_id}/conditions/{condition_id}': + delete: + operationId: DeleteDiscountsDiscountConditionsCondition + summary: Delete a DiscountCondition + 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-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: + 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' + '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: Gets a DiscountCondition + 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-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: + properties: + discount_condition: + $ref: '#/components/schemas/discount_condition' + '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 DiscountCondition + 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: + 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 + 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" ] - } - } - }, - { - "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": [ + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: '#/components/schemas/discount' + '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-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: + 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 + '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: Retrieve 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-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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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: + 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 + 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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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-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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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: Retrieve a 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-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: + properties: + discount: + $ref: '#/components/schemas/discount' + '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: + required: + - email + - items + - 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. + $ref: '#/components/schemas/address' + shipping_address: + description: The Address to be used for shipping. + $ref: '#/components/schemas/address' + 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 + 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: [ { - "type": "string", - "description": "ID of a Region." - }, + quantity: 1 + } + ], + shipping_methods: [ { - "type": "array", - "items": { - "type": "string", - "description": "ID of a Region." - } + 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: + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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-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: + properties: + draft_orders: + type: array + items: + $ref: '#/components/schemas/draft-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 + '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 for Draft Order + 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: + 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 + 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: + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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-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: + 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 + '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: Retrieve 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-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: + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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-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: + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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 for a Draft Order + 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: + 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 + 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: + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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 for a Draft Order + 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-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: + properties: + order: + $ref: '#/components/schemas/draft-order' + '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: + 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. + $ref: '#/components/schemas/address' + shipping_address: + description: The Address to be used for shipping. + $ref: '#/components/schemas/address' + 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 + 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: + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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: + 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 + 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: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + '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-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: + properties: + gift_cards: + type: array + items: + $ref: '#/components/schemas/gift_card' + 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 + '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-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: + 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 + '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: Retrieve 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-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: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + '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: + 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 + 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: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + '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: + 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 + 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: + 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 + 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 all Invites + description: Lists all Invites + x-authenticated: true + 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: + properties: + invites: + type: array + items: + $ref: '#/components/schemas/invite' + '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: Create an Invite + description: Creates an Invite and triggers an 'invite' created event + x-authenticated: true + parameters: + - in: path + name: invite_id + required: true + description: The ID of the Invite + 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.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: + properties: + id: + type: string + description: The ID of the deleted Invite. + object: + type: string + description: The type of the object that was deleted. + format: invite + deleted: + type: boolean + description: Whether or not the Invite 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' + '/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-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: + 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. + 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: + properties: + note: + $ref: '#/components/schemas/note' + '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-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: + 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 + '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: Deletes 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-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: + 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 + '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 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-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: + properties: + note: + $ref: '#/components/schemas/note' + '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: Updates 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: + required: + - value + properties: + value: + type: string + description: The updated description of the Note. + 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: + properties: + note: + $ref: '#/components/schemas/note' + '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-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: + properties: + notifications: + type: array + items: + $ref: '#/components/schemas/notification' + '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: + properties: + to: + description: >- + A new address or user identifier that the Notification + should be sent to + 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.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: + properties: + notification: + $ref: '#/components/schemas/notification' + '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}/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. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + 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.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: + properties: + order: + $ref: '#/components/schemas/order' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - price + - option_id + properties: + price: + type: integer + 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. + data: + type: object + description: >- + The data required for the Shipping Option to create a + Shipping Method. This will depend on the Fulfillment + Provider. + '/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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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: Cancels 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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: Cancels a fulfilmment related to a Claim + description: Registers a 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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: Cancels a fulfilmment related to a Swap + description: Registers a 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 an Order + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + 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: + 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: + 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: + 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 + 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 + 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 } ] - } - }, - { - "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" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } + }) + + .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 } - } - } - } - } - } - } - }, - "/orders/{id}/swaps/{swap_id}/process-payment": { - "post": { - "operationId": "PostOrdersOrderSwapsSwapProcessPayment", - "summary": "Process a Swap difference", - "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" - } - } - ], - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "items" - ], - "properties": { - "items": { - "description": "The Line Items that will be returned.", - "type": "array", - "items": { - "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" - } - } - } - } - } - }, - "tags": [ - "Return", - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "claim_items": { - "description": "The Claim Items that the Claim will consist of.", - "type": "array", - "items": { - "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": { - "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" - } - } - } - }, - "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" - } - } - } - } - } - }, - "tags": [ - "Claim" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/price-lists/{id}/prices/batch": { - "post": { - "operationId": "PostPriceListsPriceListPricesBatch", - "summary": "Batch update prices for a Price List", - "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": { - "properties": { - "prices": { - "description": "The prices to update or add.", - "type": "array", - "items": { - "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" - } - } - } - } - } - }, - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "price_list": { - "$ref": "#/components/schemas/price_list" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeletePriceListsPriceListPricesBatch", - "summary": "Batch delete prices that belong to a Price List", - "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": { - "properties": { - "price_ids": { - "description": "The price id's of the Money Amounts to delete.", - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - }, - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - } - }, - "/price-lists": { - "post": { - "operationId": "PostPriceListsPriceList", - "summary": "Creates a Price List", - "description": "Creates a Price List", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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": { - "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": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "The ID of a customer group", - "type": "string" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "price_list": { - "$ref": "#/components/schemas/price_list" - } - } - } - } - } - } - } - }, - "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" - } - } - } - } - ], - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "price_lists": { - "type": "array", - "items": { - "$ref": "#/components/schemas/price_list" - } - }, - "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" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetPriceListsPriceList", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "price_list": { - "$ref": "#/components/schemas/price_list" - } - } - } - } - } - } - } - }, - "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": { - "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": { - "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": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "The ID of a customer group", - "type": "string" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "price_list": { - "$ref": "#/components/schemas/price_list" - } - } - } - } - } - } - } - } - }, - "/price-lists/{id}/products/{product_id}/prices": { - "delete": { - "operationId": "DeletePriceListsPriceListProductsProductPrices", - "summary": "Delete all the prices related to a specific product in a price list", - "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" - } - } - ], - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - } - }, - "/price-lists/{id}/variants/{variant_id}/prices": { - "delete": { - "operationId": "DeletePriceListsPriceListVariantsVariantPrices", - "summary": "Delete all the prices related to a specific variant in a price list", - "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" - } - } - ], - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - } - }, - "/price-lists/{id}/products": { - "get": { - "operationId": "GetPriceListsPriceListProducts", - "summary": "List Product in a Price List", - "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" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/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": "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" - } - } - } - } - ], - "tags": [ - "Product Tag" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product_tags": { - "$ref": "#/components/schemas/product_tag" - }, - "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" - } - } - } - } - } - } - } - } - }, - "/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": 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": "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" - } - } - } - } - ], - "tags": [ - "Product Type" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product_types": { - "$ref": "#/components/schemas/product_type" - }, - "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" - } - } - } - } - } - } - } - } - }, - "/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": { - "required": [ - "title" - ], - "properties": { - "title": { - "description": "The title the Product Option will be identified by i.e. \"Size\"", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - }, - "/products": { - "post": { - "operationId": "PostProducts", - "summary": "Create a Product", - "x-authenticated": true, - "description": "Creates a Product", - "requestBody": { - "content": { - "application/json": { - "schema": { - "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": { - "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": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "The ID of an existing Sales channel.", - "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": { - "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": { - "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": { - "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": { - "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 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" - }, - "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" - } - } - } - } - } - }, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetProducts", - "summary": "List Product", - "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": "id", - "style": "form", - "explode": false, - "description": "Filter by product IDs.", - "schema": { - "oneOf": [ + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + required: + - items + properties: + items: + description: The Line Items to include in the Fulfillment. + type: array + items: + 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 + 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: [ { - "type": "string", - "description": "ID of the product to search for." - }, - { - "type": "array", - "items": { - "type": "string", - "description": "ID of a product." - } + item_id, + quantity: 1 } ] - } - }, - { - "in": "query", - "name": "status", - "style": "form", - "explode": false, - "description": "Status to search for", - "schema": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "draft", - "proposed", - "published", - "rejected" + }) + + .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 + } ] - } - } - }, - { - "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": "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": "type", - "description": "type ID to search for.", - "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" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/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": { - "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" - }, - "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": { - "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": { - "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" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetProductsProductVariants", - "summary": "List a Product's Product 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 - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "variants": { - "type": "array", - "items": { - "$ref": "#/components/schemas/product_variant" - } - }, - "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" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - }, - "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": { - "required": [ - "title" - ], - "properties": { - "title": { - "description": "The title of the Product Option", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetProductsProduct", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - }, - "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": { - "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": { - "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": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "The ID of an existing Sales channel.", - "type": "string" - } - } - } - }, - "variants": { - "description": "A list of Product Variants to create with the Product.", - "type": "array", - "items": { - "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": { - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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": "variant" - }, - "deleted": { - "type": "boolean", - "description": "Whether or not the items were deleted.", - "default": true - }, - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - }, - "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": { - "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 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": { - "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": { - "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" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - }, - "/products/tag-usage": { - "get": { - "operationId": "GetProductsTagUsage", - "summary": "List Product Tags Usage Number", - "description": "Retrieves a list of Product Tags with how many times each is used.", - "x-authenticated": true, - "tags": [ - "Product Tag" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tags": { - "type": "array", - "items": { - "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" - } - } - } - } - } - } - } - } - } - } - } - }, - "/products/types": { - "get": { - "operationId": "GetProductsTypes", - "summary": "List Product Types", - "description": "Retrieves a list of Product Types.", - "x-authenticated": true, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "types": { - "type": "array", - "items": { - "$ref": "#/components/schemas/product_type" - } - } - } - } - } - } - } - } - } - }, - "/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": { - "required": [ - "key", - "value" - ], - "properties": { - "key": { - "description": "The metadata key", - "type": "string" - }, - "value": { - "description": "The metadata value", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - }, - "/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": { - "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." - } - } - } - } - } - } - }, - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/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": { - "required": [ - "provider_id" - ], - "properties": { - "provider_id": { - "description": "The ID of the Fulfillment Provider to add.", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/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": { - "required": [ - "provider_id" - ], - "properties": { - "provider_id": { - "description": "The ID of the Payment Provider to add.", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/regions": { - "post": { - "operationId": "PostRegions", - "summary": "Create a Region", - "description": "Creates a Region", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - }, - "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." - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetRegionsRegion", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - }, - "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": { - "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" - }, - "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" - } - } - } - } - } - } - }, - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/regions/{id}/fulfillment-options": { - "get": { - "operationId": "GetRegionsRegionFulfillmentOptions", - "summary": "List Fulfillment Options available in the Region", - "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" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "fulfillment_options": { - "type": "array", - "items": { - "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 - } - ] - } - } - } - } - } - } - } - } - } - } - } - }, - "/regions/{id}/countries/{country_code}": { - "delete": { - "operationId": "PostRegionsRegionCountriesCountry", - "summary": "Remove 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." - } - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/regions/{id}/fulfillment-providers/{provider_id}": { - "delete": { - "operationId": "PostRegionsRegionFulfillmentProvidersProvider", - "summary": "Remove 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" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/regions/{id}/payment-providers/{provider_id}": { - "delete": { - "operationId": "PostRegionsRegionPaymentProvidersProvider", - "summary": "Remove 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" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/return-reasons": { - "post": { - "operationId": "PostReturnReasons", - "summary": "Create a Return Reason", - "description": "Creates a Return Reason", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reason": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetReturnReasons", - "summary": "List Return Reasons", - "description": "Retrieves a list of Return Reasons.", - "x-authenticated": true, - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reasons": { - "type": "array", - "items": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetReturnReasonsReason", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reason": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - }, - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reason": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Return" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Return" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/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": { - "required": [ - "items" - ], - "properties": { - "items": { - "description": "The Line Items that have been received.", - "type": "array", - "items": { - "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" - } - } - } - } - } - }, - "tags": [ - "Return" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return": { - "$ref": "#/components/schemas/return" - } - } - } - } - } - } - } - } - }, - "/sales-channels/{id}/products/batch": { - "post": { - "operationId": "PostSalesChannelsChannelProductsBatch", - "summary": "Assign a batch of product to a sales channel", - "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": { - "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" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Sales Channel" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "sales_channel": { - "$ref": "#/components/schemas/sales_channel" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteSalesChannelsChannelProductsBatch", - "summary": "Remove a list of products from a sales channel", - "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": { - "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" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Sales Channel" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "sales_channel": { - "$ref": "#/components/schemas/sales_channel" - } - } - } - } - } - } - } - } - }, - "/sales-channels": { - "post": { - "operationId": "PostSalesChannels", - "summary": "Create a Sales Channel", - "description": "Creates a Sales Channel.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Sales Channel" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "sales_channel": { - "$ref": "#/components/schemas/sales_channel" - } - } - } - } - } - } - } - }, - "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" - } - } - ], - "tags": [ - "Sales Channel" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "sales_channels": { - "type": "array", - "items": { - "$ref": "#/components/schemas/sales_channel" - } - }, - "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" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Sales Channel" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetSalesChannelsSalesChannel", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Sales Channel" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "sales_channel": { - "$ref": "#/components/schemas/sales_channel" - } - } - } - } - } - } - } - }, - "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": { - "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." - } - } - } - } - } - }, - "tags": [ - "Sales Channel" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "sales_channel": { - "$ref": "#/components/schemas/sales_channel" - } - } - } - } - } - } - } - } - }, - "/shipping-options": { - "post": { - "operationId": "PostShippingOptions", - "summary": "Create Shipping Option", - "description": "Creates a Shipping Option", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "Shipping Option" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_option": { - "$ref": "#/components/schemas/shipping_option" - } - } - } - } - } - } - } - }, - "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" - } - ], - "tags": [ - "Shipping Option" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_options": { - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_option" - } - }, - "count": { - "type": "integer", - "description": "The total number of items available" - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Shipping Option" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetShippingOptionsOption", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Shipping Option" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_option": { - "$ref": "#/components/schemas/shipping_option" - } - } - } - } - } - } - } - }, - "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": { - "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": { - "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" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Shipping Option" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_option": { - "$ref": "#/components/schemas/shipping_option" - } - } - } - } - } - } - } - } - }, - "/shipping-profiles": { - "post": { - "operationId": "PostShippingProfiles", - "summary": "Create a Shipping Profile", - "description": "Creates a Shipping Profile", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "name" - ], - "properties": { - "name": { - "description": "The name of the Shipping Profile", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profile": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetShippingProfiles", - "summary": "List Shipping Profiles", - "description": "Retrieves a list of Shipping Profile.", - "x-authenticated": true, - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profiles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetShippingProfilesProfile", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profile": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostShippingProfilesProfile", - "summary": "Update a Shipping Profiles", - "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": { - "properties": { - "name": { - "description": "The name of the Shipping Profile", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profile": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - } - }, - "/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." - } - } - } - ], - "tags": [ - "Store" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "store": { - "$ref": "#/components/schemas/store" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteStoreCurrenciesCode", - "summary": "Remove 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." - } - } - } - ], - "tags": [ - "Store" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "store": { - "$ref": "#/components/schemas/store" - } - } - } - } - } - } - } - } - }, - "/store": { - "get": { - "operationId": "GetStore", - "summary": "Retrieve Store details.", - "description": "Retrieves the Store details", - "x-authenticated": true, - "tags": [ - "Store" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "store": { - "$ref": "#/components/schemas/store" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostStore", - "summary": "Update Store details.", - "description": "Updates the Store details", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "Store" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "store": { - "$ref": "#/components/schemas/store" - } - } - } - } - } - } - } - } - }, - "/store/payment-providers": { - "get": { - "operationId": "GetStorePaymentProviders", - "summary": "Retrieve configured Payment Providers", - "description": "Retrieves the configured Payment Providers", - "x-authenticated": true, - "tags": [ - "Store" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "payment_providers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/payment_provider" - } - } - } - } - } - } - } - } - } - }, - "/store/tax-providers": { - "get": { - "operationId": "GetStoreTaxProviders", - "summary": "Retrieve configured Tax Providers", - "description": "Retrieves the configured Tax Providers", - "x-authenticated": true, - "tags": [ - "Store" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_providers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_provider" - } - } - } - } - } - } - } - } - } - }, - "/swaps/{id}": { - "get": { - "operationId": "GetSwapsSwap", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "swap": { - "$ref": "#/components/schemas/swap" - } - } - } - } - } - } - } - } - }, - "/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, - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/tax-rates/{id}/product-types/batch": { - "post": { - "operationId": "PostTaxRatesTaxRateProductTypes", - "summary": "Add Tax Rate 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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteTaxRatesTaxRateProductTypes", - "summary": "Remove Tax Rate 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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - } - }, - "/tax-rates/{id}/products/batch": { - "post": { - "operationId": "PostTaxRatesTaxRateProducts", - "summary": "Add Tax Rate 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": { - "required": [ - "products" - ], - "properties": { - "products": { - "type": "array", - "description": "The IDs of the products to associate with this tax rate", - "items": { - "type": "string" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteTaxRatesTaxRateProducts", - "summary": "Removes Tax Rate 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": { - "required": [ - "products" - ], - "properties": { - "products": { - "type": "array", - "description": "The IDs of the products to remove association with this tax rate", - "items": { - "type": "string" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - } - }, - "/tax-rates/{id}/shipping-options/batch": { - "post": { - "operationId": "PostTaxRatesTaxRateShippingOptions", - "summary": "Add Tax Rate to Product Types", - "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": { - "required": [ - "shipping_options" - ], - "properties": { - "shipping_options": { - "type": "array", - "description": "The IDs of the shipping options to associate with this tax rate", - "items": { - "type": "string" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteTaxRatesTaxRateShippingOptions", - "summary": "Removes a Tax Rate 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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - } - }, - "/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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - }, - "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": [ + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + 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 + Claim. + type: boolean + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + required: + - return_items + properties: + return_items: + description: The Line Items to return as part of the Swap. + type: array + items: + 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: + 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: + 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 + 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: [ { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } + item_id, + quantity: 1 } ] - } - }, - { - "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" - } + }) + + .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: + properties: + order: + $ref: '#/components/schemas/order' + '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 a 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 + requestBody: + content: + application/json: + schema: + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 a 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 + requestBody: + content: + application/json: + schema: + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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: Retrieve 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + properties: + email: + description: the email for the order + type: string + billing_address: + description: Billing address + anyOf: + - $ref: '#/components/schemas/address' + shipping_address: + description: Shipping address + anyOf: + - $ref: '#/components/schemas/address' + items: + description: The Line Items for the order + type: array + items: + $ref: '#/components/schemas/line_item' + 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/line_item' + description: Items to ship + no_notification: + description: >- + A flag to indicate if no notifications should be emitted + related to the updated order. + type: boolean + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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-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: + 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 + '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 a Swap difference + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + required: + - items + properties: + items: + description: The Line Items that will be returned. + type: array + items: + 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 + 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 } ] - } - }, - { - "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" - } - } - } - ], - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rates": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } - }, - "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" - } + }) + + .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: + properties: + order: + $ref: '#/components/schemas/order' + '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 + requestBody: + content: + application/json: + schema: + properties: + claim_items: + description: The Claim Items that the Claim will consist of. + type: array + items: + 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: + 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 + 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 + 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: + properties: + order: + $ref: '#/components/schemas/order' + '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: Batch update prices for a Price List + 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: + properties: + prices: + description: The prices to update or add. + type: array + items: + 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 + 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' } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetTaxRatesTaxRate", - "summary": "Get 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, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - }, - "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": { - "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" - } - } - } - } - } - } - }, - "tags": [ - "Tax Rate" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tax_rate": { - "$ref": "#/components/schemas/tax_rate" - } - } - } - } - } - } - } - } - }, - "/uploads": { - "post": { - "operationId": "PostUploads", - "summary": "Uploads a file", - "description": "Uploads a file to the specific fileservice that is installed in Medusa.", - "x-authenticated": true, - "tags": [ - "Upload" - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "files": { - "type": "string", - "format": "binary" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "uploads": { - "type": "array", - "items": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "The URL of the uploaded file.", - "format": "uri" - } - } - } - } - } - } - } - } - } - } - } - }, - "/users": { - "post": { - "operationId": "PostUsers", - "summary": "Create a User", - "description": "Creates a User", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "User" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetUsers", - "summary": "Retrieve all users", - "description": "Retrieves all users.", - "x-authenticated": true, - "tags": [ - "User" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "users": { - "type": "array", - "items": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - } - } - } - } - }, - "/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" - } - } - ], - "tags": [ - "Users" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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 - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetUsersUser", - "summary": "Retrieve 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" - } - } - ], - "tags": [ - "User" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - } - } - }, - "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": { - "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" - } - } - } - } - } - }, - "tags": [ - "User" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - } - } - } - }, - "/users/password-token": { - "post": { - "operationId": "PostUsersUserPasswordToken", - "summary": "Generate a password token for a User.", - "description": "Generates a password token for a User with a given email.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "email" - ], - "properties": { - "email": { - "description": "The Users email.", - "type": "string", - "format": "email" - } - } - } - } - } - }, - "tags": [ - "User" - ], - "responses": { - "204": { - "description": "OK" - } - } - } - }, - "/users/reset-password": { - "post": { - "operationId": "PostUsersUserPassword", - "summary": "Set the password for a User.", - "description": "Sets the password for a User given the correct token.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - }, - "tags": [ - "User" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - } - } - } - }, - "/variants": { - "get": { - "operationId": "GetVariants", - "summary": "List Product Variants.", - "description": "Retrieves a list of Product Variants", - "x-authenticated": true, - "parameters": [ - { - "in": "query", - "name": "q", - "description": "Query used for searching variants.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "offset", - "description": "How many variants to skip in the result.", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "in": "query", - "name": "limit", - "description": "Limit the number of variants returned.", - "schema": { - "type": "integer", - "default": 20 - } - } - ], - "tags": [ - "Product Variant" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "variants": { - "type": "array", - "items": { - "$ref": "#/components/schemas/product_variant" - } - }, - "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" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "address": { - "title": "Address", - "description": "An address.", - "x-resourceId": "address", - "properties": { - "id": { - "type": "string", - "description": "ID of the address", - "example": "addr_01G8ZC9VS1XVE149MGH2J7QSSH" - }, - "customer_id": { - "type": "string", - "description": "ID of the customer this address belongs to", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "Available if the relation `customer` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A customer object." - } - }, - "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" - }, - "country": { - "description": "A country object. Available if the relation `country` is expanded.", - "type": "object" - }, - "province": { - "type": "string", - "description": "Province", - "example": "Kentucky" - }, - "postal_code": { - "type": "string", - "description": "Postal Code", - "example": 72093 - }, - "phone": { - "type": "string", - "description": "Phone Number", - "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": { - "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" - } - } - } - }, - "batch_job": { - "title": "Batch Job", - "description": "A Batch Job.", - "x-resourceId": "batch_job", - "required": [ - "type" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique identifier for the batch job.", - "example": "batch_01G8T782965PYFG0751G0Z38B4" - }, - "type": { - "type": "string", - "description": "The type of batch job.", - "enum": [ - "product-import", - "product-export" - ] - }, - "status": { - "type": "string", - "description": "The status of the batch job.", - "enum": [ - "created", - "pre_processed", - "confirmed", - "processing", - "completed", - "canceled", - "failed" - ], - "default": "created" - }, - "created_by": { - "type": "string", - "description": "The unique identifier of the user that created the batch job.", - "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" - }, - "created_by_user": { - "description": "A user object. Available if the relation `created_by_user` is expanded.", - "type": "object" - }, - "context": { - "type": "object", - "description": "The context of the batch job, the type of the batch job determines what the context should contain.", - "example": { - "shape": { + ] + }) + + .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": [ { - "region": null, + "amount": 100, + "variant_id": "afasfa", + "currency_code": "eur" + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_list: + $ref: '#/components/schemas/price_list' + '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: Batch delete prices that belong to a Price List + 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: + properties: + price_ids: + description: The price id's of the Money Amounts to delete. + type: array + items: + 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.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: + 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 + '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: Creates a Price List + description: Creates a Price List + x-authenticated: true + requestBody: + content: + application/json: + schema: + 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: + 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: + required: + - id + properties: + id: + description: The ID of a customer group + type: string + 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: + properties: + price_list: + $ref: '#/components/schemas/price_list' + '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-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: + properties: + price_lists: + type: array + items: + $ref: '#/components/schemas/price_list' + 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 + '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-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: + 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 + '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: Retrieve 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-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: + properties: + price_list: + $ref: '#/components/schemas/price_list' + '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: + 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: + 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: + required: + - id + properties: + id: + description: The ID of a customer group + 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.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: + properties: + price_list: + $ref: '#/components/schemas/price_list' + '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 all the prices related to a specific product in a price list + 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-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: + 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 + '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 all the prices related to a specific variant in a price list + 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-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: + 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 + '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 Product in a Price List + 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-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: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + 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 + '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: 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-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: + properties: + product_tags: + $ref: '#/components/schemas/product_tag' + 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 + '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: 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: 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-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: + properties: + product_types: + $ref: '#/components/schemas/product_type' + 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 + '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: + required: + - title + properties: + title: + description: >- + The title the Product Option will be identified by i.e. + "Size" + 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.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: + properties: + product: + $ref: '#/components/schemas/product' + '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: + 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: + 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: + required: + - id + properties: + id: + description: The ID of an existing Sales channel. + 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: + 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: + 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: + 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: + 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 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 + 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 + 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: + properties: + product: + $ref: '#/components/schemas/product' + '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 Product + 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: 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: 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: type + description: type ID to search for. + 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-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: + 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 + '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: + 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 + 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: + 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: + 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 + 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" } ], - "dynamicImageColumnCount": 4, - "dynamicOptionColumnCount": 2 - }, - "list_config": { - "skip": 0, - "take": 50, - "order": { - "created_at": "DESC" - }, - "relations": [ - "variants", - "variant.prices", - "images" + "options": [ + { + "option_id": "asdasf", + "value": "S" + } ] - } - } - }, - "dry_run": { - "type": "boolean", - "description": "Specify if the job must apply the modifications or not.", - "default": false - }, - "result": { - "type": "object", - "description": "The result of the batch job.", - "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": [ + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: '#/components/schemas/product' + '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 Product 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-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: + properties: + variants: + type: array + items: + $ref: '#/components/schemas/product_variant' + 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 + '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-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: + 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' + '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: + required: + - title + properties: + title: + description: The title of the Product Option + 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.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: + properties: + product: + $ref: '#/components/schemas/product' + '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-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: + 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 + '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: Retrieve 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-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: + properties: + product: + $ref: '#/components/schemas/product' + '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: + 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: + 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: + required: + - id + properties: + id: + description: The ID of an existing Sales channel. + type: string + variants: + description: A list of Product Variants to create with the Product. + type: array + items: + 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: + 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: + 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 + 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: + properties: + product: + $ref: '#/components/schemas/product' + '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-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: + 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: variant + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true + product: + $ref: '#/components/schemas/product' + '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: + 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 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: + 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: + 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 + 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: [ { - "err": [], - "code": "unknown", - "message": "Method not implemented." + amount: 1000, + currency_code: "eur" } ], - "stat_descriptors": [ + options: [ { - "key": "product-export-count", - "name": "Product count to export", - "message": "There will be 8 products exported by this action" + 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: + properties: + product: + $ref: '#/components/schemas/product' + '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 Product Tags Usage Number + description: Retrieves a list of Product Tags with how many times each is used. + x-authenticated: true + 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: + properties: + tags: + type: array + items: + 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 + '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: + operationId: GetProductsTypes + summary: List Product Types + description: Retrieves a list of Product Types. + x-authenticated: true + 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: + properties: + types: + type: array + items: + $ref: '#/components/schemas/product_type' + '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: + required: + - key + - value + properties: + key: + description: The metadata key + type: string + value: + description: The metadata value + 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.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: + properties: + product: + $ref: '#/components/schemas/product' + '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: + 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. + 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: + properties: + region: + $ref: '#/components/schemas/region' + '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: + required: + - provider_id + properties: + provider_id: + description: The ID of the Fulfillment Provider to add. + 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.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: + properties: + region: + $ref: '#/components/schemas/region' + '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: + required: + - provider_id + properties: + provider_id: + description: The ID of the Payment Provider to add. + 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.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: + properties: + region: + $ref: '#/components/schemas/region' + '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: + 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 + 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: + properties: + region: + $ref: '#/components/schemas/region' + '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-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: + 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 + '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-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: + 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 + '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: Retrieve 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-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: + properties: + region: + $ref: '#/components/schemas/region' + '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: + 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 + 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 + 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: + properties: + region: + $ref: '#/components/schemas/region' + '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 available in the Region + 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-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: + properties: + fulfillment_options: + type: array + items: + 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 + '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: Remove 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-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: + properties: + region: + $ref: '#/components/schemas/region' + '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: Remove 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-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: + properties: + region: + $ref: '#/components/schemas/region' + '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: Remove 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-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: + properties: + region: + $ref: '#/components/schemas/region' + '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: + 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 + 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: + properties: + return_reason: + $ref: '#/components/schemas/return_reason' + '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-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: + properties: + return_reasons: + type: array + items: + $ref: '#/components/schemas/return_reason' + '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-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: + 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 + '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: Retrieve 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-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: + properties: + return_reason: + $ref: '#/components/schemas/return_reason' + '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: + 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 + 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: + properties: + return_reason: + $ref: '#/components/schemas/return_reason' + '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-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: + properties: + order: + $ref: '#/components/schemas/order' + '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-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: + 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 + '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: + required: + - items + properties: + items: + description: The Line Items that have been received. + type: array + items: + 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 + 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 } ] - } - }, - "pre_processed_at": { - "type": "string", - "description": "The date from which the job has been pre processed.", - "format": "date-time" - }, - "processing_at": { - "type": "string", - "description": "The date the job is processing at.", - "format": "date-time" - }, - "confirmed_at": { - "type": "string", - "description": "The date when the confirmation has been done.", - "format": "date-time" - }, - "completed_at": { - "type": "string", - "description": "The date of the completion.", - "format": "date-time" - }, - "canceled_at": { - "type": "string", - "description": "The date of the concellation.", - "format": "date-time" - }, - "failed_at": { - "type": "string", - "description": "The date when the job failed.", - "format": "date-time" - }, - "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 last updated.", - "format": "date-time" - }, - "deleted_at": { - "type": "string", - "description": "The date with timezone at which the resource was deleted.", - "format": "date-time" - } - } - }, - "cart": { - "title": "Cart", - "description": "Represents a user cart", - "x-resourceId": "cart", - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "email": { - "type": "string", - "description": "The email associated with the cart", - "format": "email" - }, - "billing_address_id": { - "type": "string", - "description": "The billing address's ID", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "billing_address": { - "description": "Available if the relation `billing_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_address_id": { - "type": "string", - "description": "The shipping address's ID", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "items": { - "description": "Available if the relation `items` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "region_id": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "discounts": { - "type": "array", - "description": "Available if the relation `discounts` is expanded.", - "items": { - "type": "object", - "description": "A discount object." - } - }, - "gift_cards": { - "type": "array", - "description": "Available if the relation `gift_cards` is expanded.", - "items": { - "type": "object", - "description": "A gift card object." - } - }, - "customer_id": { - "type": "string", - "description": "The customer's ID", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "payment_session": { - "description": "The selected payment session in the cart.", - "$ref": "#/components/schemas/payment_session" - }, - "payment_sessions": { - "type": "array", - "description": "The payment sessions created on the cart.", - "items": { - "$ref": "#/components/schemas/payment_session" - } - }, - "payment_id": { - "type": "string", - "description": "The payment's ID if available", - "example": "pay_01G8ZCC5W42ZNY842124G7P5R9" - }, - "payment": { - "description": "Available if the relation `payment` is expanded.", - "$ref": "#/components/schemas/payment" - }, - "shipping_methods": { - "type": "array", - "description": "The shipping methods added to the cart.", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "type": { - "type": "string", - "description": "The cart's type.", - "enum": [ - "default", - "swap", - "draft_order", - "payment_link", - "claim" - ], - "default": "default" - }, - "completed_at": { - "type": "string", - "description": "The date with timezone at which the cart was completed.", - "format": "date-time" - }, - "payment_authorized_at": { - "type": "string", - "description": "The date with timezone at which the payment was authorized.", - "format": "date-time" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a cart in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "context": { - "type": "object", - "description": "The context of the cart which can include info like IP or user agent.", - "example": { - "ip": "::1", - "user_agent": "PostmanRuntime/7.29.2" - } - }, - "sales_channel_id": { - "type": "string", - "description": "The sales channel ID the cart is associated with.", - "example": null - }, - "sales_channel": { - "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", - "type": "object" - }, - "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" - } - }, - "shipping_total": { - "type": "integer", - "description": "The total of shipping", - "example": 1000 - }, - "discount_total": { - "type": "integer", - "description": "The total of discount", - "example": 800 - }, - "tax_total": { - "type": "integer", - "description": "The total of tax", - "example": 0 - }, - "refunded_total": { - "type": "integer", - "description": "The total amount refunded if the order associated with this cart is returned.", - "example": 0 - }, - "total": { - "type": "integer", - "description": "The total amount of the cart", - "example": 8200 - }, - "subtotal": { - "type": "integer", - "description": "The subtotal of the cart", - "example": 8000 - }, - "refundable_amount": { - "type": "integer", - "description": "The amount that can be refunded", - "example": 8200 - }, - "gift_card_total": { - "type": "integer", - "description": "The total of gift cards", - "example": 0 - }, - "gift_card_tax_total": { - "type": "integer", - "description": "The total of gift cards with taxes", - "example": 0 - } - } - }, - "claim_image": { - "title": "Claim Image", - "description": "Represents photo documentation of a claim.", - "x-resourceId": "claim_image", - "required": [ - "claim_item_id", - "url" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim image's ID", - "example": "cimg_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "claim_item_id": { - "type": "string", - "description": "The ID of the claim item associated with the image" - }, - "claim_item": { - "description": "A claim item object. Available if the relation `claim_item` is expanded.", - "type": "object" - }, - "url": { - "type": "string", - "description": "The URL of the image", - "format": "uri" - }, - "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" - } - } - } - }, - "claim_item": { - "title": "Claim Item", - "description": "Represents a claimed item along with information about the reasons for the claim.", - "x-resourceId": "claim_item", - "required": [ - "claim_order_id", - "item_id", - "variant_id", - "reason", - "quantity" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim item's ID", - "example": "citm_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "images": { - "type": "array", - "description": "Available if the relation `images` is expanded.", - "items": { - "$ref": "#/components/schemas/claim_image" - } - }, - "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.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/line_item" - }, - "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.", - "type": "object" - }, - "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", - "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/claim_tag" - } - }, - "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" - } - } - } - }, - "claim_order": { - "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.", - "x-resourceId": "claim_order", - "required": [ - "type", - "order_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim's ID", - "example": "claim_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "type": { - "type": "string", - "enum": [ - "refund", - "replace" - ] - }, - "payment_status": { - "type": "string", - "description": "The status of the claim's payment", - "enum": [ - "na", - "not_refunded", - "refunded" - ], - "default": "na" - }, - "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/claim_item" - } - }, - "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/line_item" - } - }, - "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.", - "type": "object" - }, - "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", - "type": "object" - }, - "shipping_address_id": { - "description": "The ID of the address that the new items should be shipped to", - "type": "string", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_methods": { - "description": "The shipping methods that the claim order will be shipped with.", - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "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", - "type": "integer", - "example": 1000 - }, - "canceled_at": { - "description": "The date with timezone at which the claim was canceled.", - "type": "string", - "format": "date-time" - }, - "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" - } - }, - "no_notification": { - "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the cart associated with the claim in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - } - } - }, - "claim_tag": { - "title": "Claim Tag", - "description": "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping.", - "x-resourceId": "claim_tag", - "required": [ - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim tag's ID", - "example": "ctag_01G8ZCC5Y63B95V6B5SHBZ91S4" - }, - "value": { - "description": "The value that the claim tag holds", - "type": "string", - "example": "Damaged" - }, - "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" - } - } - } - }, - "country": { - "title": "Country", - "description": "Country details", - "x-resourceId": "country", - "required": [ - "iso_2", - "iso_3", - "num_code", - "name", - "display_name" - ], - "properties": { - "id": { - "type": "string", - "description": "The country's ID", - "example": 109 - }, - "iso_2": { - "type": "string", - "description": "The 2 character ISO code of the country in lower case", - "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": { - "type": "string", - "description": "The 2 character ISO code of the country in lower case", - "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": { - "type": "string", - "description": "The region ID this country is associated with.", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - } - } - }, - "currency": { - "title": "Currency", - "description": "Currency", - "x-resourceId": "currency", - "required": [ - "code", - "symbol", - "symbol_native", - "name" - ], - "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" - } - } - }, - "custom_shipping_option": { - "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", - "x-resourceId": "custom_shipping_option", - "required": [ - "price", - "shipping_option_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The custom shipping option's ID", - "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.", - "type": "object" - }, - "cart_id": { - "description": "The ID of the Cart that the custom shipping option is attached to", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "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" - } - } - } - }, - "customer_group": { - "title": "Customer Group", - "description": "Represents a customer group", - "x-resourceId": "customer_group", - "required": [ - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The customer group's ID", - "example": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "name": { - "type": "string", - "description": "The name of the customer group", - "example": "VIP" - }, - "customers": { - "type": "array", - "description": "The customers that belong to the customer group. Available if the relation `customers` is expanded.", - "items": { - "type": "object", - "description": "A customer object." - } - }, - "price_lists": { - "type": "array", - "description": "The price lists that are associated with the customer group. Available if the relation `price_lists` is expanded.", - "items": { - "$ref": "#/components/schemas/price_list" - } - }, - "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" - } - } - } - }, - "customer": { - "title": "Customer", - "description": "Represents a customer", - "x-resourceId": "customer", - "required": [ - "email" - ], - "properties": { - "id": { - "type": "string", - "description": "The customer's ID", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "email": { - "type": "string", - "description": "The customer's email", - "format": "email" - }, - "first_name": { - "type": "string", - "description": "The customer's first name", - "example": "Arno" - }, - "last_name": { - "type": "string", - "description": "The customer's first name", - "example": "Willms" - }, - "billing_address_id": { - "type": "string", - "description": "The customer's billing address ID", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "billing_address": { - "description": "Available if the relation `billing_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_addresses": { - "description": "Available if the relation `shipping_addresses` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/address" - } - }, - "phone": { - "type": "string", - "description": "The customer's phone number", - "example": 16128234334802 - }, - "has_account": { - "type": "boolean", - "description": "Whether the customer has an account or not", - "default": false - }, - "orders": { - "description": "Available if the relation `orders` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "An order object." - } - }, - "groups": { - "description": "The customer groups the customer belongs to. Available if the relation `groups` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/customer_group" - } - }, - "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" - } - } - } - }, - "discount_condition_customer_group": { - "title": "Product Tag Discount Condition", - "description": "Associates a discount condition with a customer group", - "x-resourceId": "discount_condition_customer_group", - "required": [ - "customer_group_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/customer_group" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product_collection": { - "title": "Product Collection Discount Condition", - "description": "Associates a discount condition with a product collection", - "x-resourceId": "discount_condition_product_collection", - "required": [ - "product_collection_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product_collection" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product_tag": { - "title": "Product Tag Discount Condition", - "description": "Associates a discount condition with a product tag", - "x-resourceId": "discount_condition_product_tag", - "required": [ - "product_tag_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product_tag" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product_type": { - "title": "Product Type Discount Condition", - "description": "Associates a discount condition with a product type", - "x-resourceId": "discount_condition_product", - "required": [ - "product_type_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product_type" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product": { - "title": "Product Discount Condition", - "description": "Associates a discount condition with a product", - "x-resourceId": "discount_condition_product", - "required": [ - "product_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition": { - "title": "Discount Condition", - "description": "Holds rule conditions for when a discount is applicable", - "x-resourceId": "discount_condition", - "required": [ - "type", - "operator", - "discount_rule_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The discount condition's ID", - "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": { - "type": "string", - "description": "The ID of the discount rule associated with the condition", - "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" - }, - "discount_rule": { - "description": "Available if the relation `discount_rule` is expanded.", - "$ref": "#/components/schemas/discount_rule" - }, - "products": { - "description": "products associated with this condition if type = products. Available if the relation `products` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product object." - } - }, - "product_types": { - "description": "product types associated with this condition if type = product_types. Available if the relation `product_types` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product type object." - } - }, - "product_tags": { - "description": "product tags associated with this condition if type = product_tags. Available if the relation `product_tags` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product tag object." - } - }, - "product_collections": { - "description": "product collections associated with this condition if type = product_collections. Available if the relation `product_collections` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product collection object." - } - }, - "customer_groups": { - "description": "customer groups associated with this condition if type = customer_groups. Available if the relation `customer_groups` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A customer group object." - } - }, - "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" - } - } - } - }, - "discount_rule": { - "title": "Discount Rule", - "description": "Holds the rules that governs how a Discount is calculated when applied to a Cart.", - "x-resourceId": "discount_rule", - "required": [ - "type", - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The discount rule's ID", - "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", - "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.", - "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": { - "type": "object", - "description": "A discount condition object." - } - }, - "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" - } - } - } - }, - "discount": { - "title": "Discount", - "description": "Represents a discount that can be applied to a cart for promotional purposes.", - "x-resourceId": "discount", - "required": [ - "code", - "is_dynamic" - ], - "properties": { - "id": { - "type": "string", - "description": "The discount's ID", - "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": { - "type": "string", - "description": "The Discount Rule that governs the behaviour of the Discount", - "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" - }, - "rule": { - "description": "Available if the relation `rule` is expanded.", - "$ref": "#/components/schemas/discount_rule" - }, - "is_disabled": { - "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts", - "type": "boolean", - "example": false - }, - "parent_discount_id": { - "type": "string", - "description": "The Discount that the discount was created from. This will always be a dynamic discount", - "example": "disc_01G8ZH853YPY9B94857DY91YGW" - }, - "parent_discount": { - "description": "Available if the relation `parent_discount` is expanded.", - "$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.", - "type": "string", - "format": "date-time" - }, - "valid_duration": { - "type": "string", - "description": "Duration the discount runs between", - "example": "P3Y6M4DT12H30M5S" - }, - "regions": { - "description": "The Regions in which the Discount can be used. Available if the relation `regions` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A region object." - } - }, - "usage_limit": { - "description": "The maximum number of times that a discount can be used.", - "type": "integer", - "example": 100 - }, - "usage_count": { - "description": "The number of times a discount has been used.", - "type": "integer", - "example": 50, - "default": 0 - }, - "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" - } - } - } - }, - "draft-order": { - "title": "DraftOrder", - "description": "Represents a draft order", - "x-resourceId": "draft-order", - "properties": { - "id": { - "type": "string", - "description": "The draft order's ID", - "example": "dorder_01G8TJFKBG38YYFQ035MSVG03C" - }, - "status": { - "type": "string", - "description": "The status of the draft order", - "enum": [ - "open", - "completed" - ], - "default": "open" - }, - "display_id": { - "type": "string", - "description": "The draft order's display ID", - "example": 2 - }, - "cart_id": { - "type": "string", - "description": "The ID of the cart associated with the draft order.", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "order_id": { - "type": "string", - "description": "The ID of the order associated with the draft order.", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "canceled_at": { - "type": "string", - "description": "The date the draft order was canceled at.", - "format": "date-time" - }, - "completed_at": { - "type": "string", - "description": "The date the draft order was completed at.", - "format": "date-time" - }, - "no_notification_order": { - "type": "boolean", - "description": "Whether to send the customer notifications regarding order updates.", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "fulfillment_item": { - "title": "Fulfillment Item", - "description": "Correlates a Line Item with a Fulfillment, keeping track of the quantity of the Line Item.", - "x-resourceId": "fulfillment_item", - "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.", - "type": "object" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "quantity": { - "description": "The quantity of the Line Item that is included in the Fulfillment.", - "type": "integer", - "example": 1 - } - } - }, - "fulfillment_provider": { - "title": "Fulfillment Provider", - "description": "Represents a fulfillment provider plugin and holds its installation status.", - "x-resourceId": "fulfillment_provider", - "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", - "example": 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.", - "x-resourceId": "fulfillment", - "required": [ - "provider_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" - }, - "claim_order_id": { - "description": "The id of the Claim that the Fulfillment belongs to.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "swap_id": { - "description": "The id of the Swap that the Fulfillment belongs to.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The id of the Order that the Fulfillment belongs to.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/fulfillment_provider" - }, - "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/fulfillment_item" - } - }, - "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/tracking_link" - } - }, - "tracking_numbers": { - "deprecated": true, - "description": "The tracking numbers that can be used to track the status of the fulfillment.", - "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.", - "type": "string", - "format": "date-time" - }, - "no_notification": { - "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean", - "example": false - }, - "canceled_at": { - "description": "The date with timezone at which the Fulfillment was canceled.", - "type": "string", - "format": "date-time" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the fulfillment in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "gift_card_transaction": { - "title": "Gift Card Transaction", - "description": "Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order", - "x-resourceId": "gift_card_transaction", - "required": [ - "gift_card_id", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The gift card transaction's ID", - "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.", - "type": "object" - }, - "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.", - "type": "object" - }, - "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.", - "type": "boolean", - "example": false - }, - "tax_rate": { - "description": "The tax rate of the transaction", - "type": "number", - "example": 0 - } - } - }, - "gift_card": { - "title": "Gift Card", - "description": "Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.", - "x-resourceId": "gift_card", - "required": [ - "code", - "value", - "balance", - "region_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "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": { - "type": "string", - "description": "The id of the Region in which the Gift Card is available.", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "order_id": { - "type": "string", - "description": "The id of the Order that the Gift Card was purchased in.", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "is_disabled": { - "description": "Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts.", - "type": "boolean", - "example": false - }, - "ends_at": { - "description": "The time at which the Gift Card can no longer be used.", - "type": "string", - "format": "date-time" - }, - "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" - } - } - } - }, - "idempotency_key": { - "title": "Idempotency Key", - "description": "Idempotency Key is used to continue a process in case of any failure that might occur.", - "x-resourceId": "idempotency_key", - "required": [ - "idempotency_key" - ], - "properties": { - "id": { - "type": "string", - "description": "The idempotency key's ID", - "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.", - "type": "string", - "format": "date-time" - }, - "request_method": { - "description": "The method of the request", - "type": "string", - "example": "POST" - }, - "request_params": { - "type": "object", - "description": "The parameters passed to the request", - "example": { - "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - } - }, - "request_path": { - "description": "The request's path", - "type": "string", - "example": "/store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete" - }, - "response_code": { - "type": "string", - "description": "The response's code.", - "example": 200 - }, - "response_body": { - "type": "object", - "description": "The response's body", - "example": { - "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - } - }, - "recovery_point": { - "type": "string", - "description": "Where to continue from.", - "default": "started" - } - } - }, - "image": { - "title": "Image", - "description": "Images holds a reference to a URL at which the image file can be found.", - "x-resourceId": "image", - "required": [ - "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": { - "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" - } - } - } - }, - "invite": { - "title": "Invite", - "description": "Represents an invite", - "x-resourceId": "invite", - "required": [ - "user_email" - ], - "properties": { - "id": { - "type": "string", - "description": "The invite's ID", - "example": "invite_01G8TKE4XYCTHSCK2GDEP47RE1" - }, - "user_email": { - "type": "string", - "description": "The email of the user being invited.", - "format": "email" - }, - "role": { - "type": "string", - "description": "The user's role.", - "enum": [ - "admin", - "member", - "developer" - ], - "default": "member" - }, - "accepted": { - "type": "boolean", - "description": "Whether the invite was accepted or not.", - "example": false - }, - "token": { - "type": "string", - "description": "The token used to accept the invite." - }, - "expores_at": { - "type": "string", - "description": "The date the invite expires at.", - "format": "date-time" - }, - "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" - } - } - } - }, - "line_item_adjustment": { - "title": "Line Item Adjustment", - "description": "Represents an Line Item Adjustment", - "x-resourceId": "line_item_adjustment", - "required": [ - "item_id", - "description", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The invite's ID", - "example": "lia_01G8TKE4XYCTHSCK2GDEP47RE1" - }, - "item_id": { - "type": "string", - "description": "The ID of the line item", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "description": { - "type": "string", - "description": "The line item's adjustment description", - "example": "Adjusted item's price." - }, - "discount_id": { - "type": "string", - "description": "The ID of the discount associated with the adjustment", - "example": "disc_01F0YESMW10MGHWJKZSDDMN0VN" - }, - "discount": { - "description": "Available if the relation `discount` is expanded.", - "$ref": "#/components/schemas/discount" - }, - "amount": { - "type": "number", - "description": "The adjustment amount", - "example": 1000 - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "line_item_tax_line": { - "title": "Line Item Tax Line", - "description": "Represents an Line Item Tax Line", - "x-resourceId": "line_item_tax_line", - "required": [ - "item_id", - "rate", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The line item tax line's ID", - "example": "litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" - }, - "item_id": { - "type": "string", - "description": "The ID of the line item", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "code": { - "description": "A code to identify the tax type by", - "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": { - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "line_item": { - "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.", - "x-resourceId": "line_item", - "required": [ - "title", - "unit_price", - "quantity" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "cart_id": { - "description": "The ID of the Cart that the Line Item belongs to.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The ID of the Order that the Line Item belongs to.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "swap_id": { - "description": "The id of the Swap that the Line Item belongs to.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "claim_order_id": { - "description": "The id of the Claim that the Line Item belongs to.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "tax_lines": { - "description": "Available if the relation `tax_lines` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item_tax_line" - } - }, - "adjustments": { - "description": "Available if the relation `adjustments` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item_adjustment" - } - }, - "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.", - "type": "string", - "example": "One Size" - }, - "thumbnail": { - "description": "A URL string to a small image of the contents of the Line Item.", - "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", - "example": false - }, - "is_giftcard": { - "description": "Flag to indicate if the Line Item is a Gift Card.", - "type": "boolean", - "example": 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", - "example": false - }, - "allow_discounts": { - "description": "Flag to indicate if the Line Item should be included when doing discount calculations.", - "type": "boolean", - "example": false - }, - "has_shipping": { - "description": "Flag to indicate if the Line Item has fulfillment associated with it.", - "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": "boolean", - "example": 8000 - }, - "variant_id": { - "description": "The id of the Product Variant contained in the Line Item.", - "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.", - "type": "object" - }, - "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.", - "type": "integer", - "example": 0 - }, - "returned_quantity": { - "description": "The quantity of the Line Item that has been returned.", - "type": "integer", - "example": 0 - }, - "shipped_quantity": { - "description": "The quantity of the Line Item that has been shipped.", - "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": { - "type": "integer", - "description": "The subtotal of the line item", - "example": 8000 - }, - "tax_total": { - "type": "integer", - "description": "The total of tax of the line item", - "example": 0 - }, - "total": { - "type": "integer", - "description": "The total amount of the line item", - "example": 8000 - }, - "original_total": { - "type": "integer", - "description": "The original total amount of the line item", - "example": 8000 - }, - "original_tax_total": { - "type": "integer", - "description": "The original tax total amount of the line item", - "example": 0 - }, - "discount_total": { - "type": "integer", - "description": "The total of discount of the line item", - "example": 0 - }, - "gift_card_total": { - "type": "integer", - "description": "The total of the gift card of the line item", - "example": 0 - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "money_amount": { - "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.", - "x-resourceId": "money_amount", - "required": [ - "currency_code", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The money amount's ID", - "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.", - "$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.", - "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.", - "type": "integer", - "example": 1 - }, - "price_list_id": { - "type": "string", - "description": "The ID of the price list associated with the money amount", - "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" - }, - "price_list": { - "description": "Available if the relation `price_list` is expanded.", - "$ref": "#/components/schemas/price_list" - }, - "variant_id": { - "description": "The id of the Product Variant contained in the Line Item.", - "type": "string", - "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" - }, - "variant": { - "description": "The Product Variant contained in the Line Item. Available if the relation `variant` is expanded.", - "type": "object" - }, - "region_id": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "note", - "required": [ - "value", - "resource_type", - "resource_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The note's ID", - "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": { - "type": "string", - "description": "The ID of the author (user)", - "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" - }, - "author": { - "description": "Available if the relation `author` is expanded.", - "$ref": "#/components/schemas/user" - }, - "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" - } - } - } - }, - "notification_provider": { - "title": "Notification Provider", - "description": "Represents a notification provider plugin and holds its installation status.", - "x-resourceId": "notification_provider", - "required": [ - "id" - ], - "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.", - "x-resourceId": "notification", - "required": [ - "resource_type", - "resource_id", - "to" - ], - "properties": { - "id": { - "type": "string", - "description": "The notification's ID", - "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" - }, - "event_name": { - "description": "The name of the event that the notification was sent for.", - "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.", - "type": "string", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "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": {} - }, - "resends": { - "description": "The resends that have been completed after the original Notification.", - "type": "array", - "items": { - "$ref": "#/components/schemas/notification_resend" - } - }, - "provider_id": { - "description": "The id of the Notification Provider that handles the Notification.", - "type": "string", - "example": "sengrid" - }, - "provider": { - "description": "Available if the relation `provider` is expanded.", - "$ref": "#/components/schemas/notification_provider" - }, - "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" - } - } - }, - "notification_resend": { - "title": "Notification Resend", - "description": "A resend of a Notification.", - "x-resourceId": "notification_resend", - "properties": { - "id": { - "description": "The notification resend's ID", - "type": "string", - "example": "noti_01F0YET45G9NHP08Z66CE4QKBS" - }, - "event_name": { - "description": "The name of the event that the notification was sent for.", - "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.", - "type": "string", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "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 ID of the Notification that was originally sent.", - "type": "string", - "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" - }, - "parent_notification": { - "description": "Available if the relation `parent_notification` is expanded.", - "$ref": "#/components/schemas/notification" - }, - "provider_id": { - "description": "The ID of the Notification Provider that handles the Notification.", - "type": "string", - "example": "sengrid" - }, - "provider": { - "description": "Available if the relation `provider` is expanded.", - "$ref": "#/components/schemas/notification_provider" - }, - "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" - } - } - }, - "OAuth": { - "title": "OAuth", - "description": "Represent an OAuth app", - "x-resourceId": "OAuth", - "required": [ - "id", - "display_name", - "application_name" - ], - "properties": { - "id": { - "type": "string", - "description": "The app's ID", - "example": "example_app" - }, - "display_name": { - "type": "string", - "description": "The app's display name", - "example": "Example app" - }, - "application_name": { - "type": "string", - "description": "The app's name", - "example": "example" - }, - "install_url": { - "type": "string", - "description": "The URL to install the app", - "format": "uri" - }, - "uninstall_url": { - "type": "string", - "description": "The URL to uninstall the app", - "format": "uri" - }, - "data": { - "type": "object", - "description": "Any data necessary to the app.", - "example": {} - } - } - }, - "order": { - "title": "Order", - "description": "Represents an order", - "x-resourceId": "order", - "required": [ - "customer_id", - "email", - "region_id", - "currency_code" - ], - "properties": { - "id": { - "type": "string", - "description": "The order's ID", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "status": { - "type": "string", - "description": "The order's status", - "enum": [ - "pending", - "completed", - "archived", - "canceled", - "requires_action" - ], - "default": "pending" - }, - "fulfillment_status": { - "type": "string", - "description": "The order's fulfillment status", - "enum": [ - "not_fulfilled", - "partially_fulfilled", - "fulfilled", - "partially_shipped", - "shipped", - "partially_returned", - "returned", - "canceled", - "requires_action" - ], - "default": "not_fulfilled" - }, - "payment_status": { - "type": "string", - "description": "The order's payment status", - "enum": [ - "not_paid", - "awaiting", - "captured", - "partially_refunded", - "refuneded", - "canceled", - "requires_action" - ], - "default": "not_paid" - }, - "display_id": { - "type": "integer", - "description": "The order's display ID", - "example": 2 - }, - "cart_id": { - "type": "string", - "description": "The ID of the cart associated with the order", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "customer_id": { - "type": "string", - "description": "The ID of the customer associated with the order", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "email": { - "description": "The email associated with the order", - "type": "string", - "format": "email" - }, - "billing_address_id": { - "type": "string", - "description": "The ID of the billing address associated with the order", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "billing_address": { - "description": "Available if the relation `billing_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_address_id": { - "type": "string", - "description": "The ID of the shipping address associated with the order", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "region_id": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/currency" - }, - "tax_rate": { - "description": "The order's tax rate", - "type": "number", - "example": 0 - }, - "discounts": { - "type": "array", - "description": "The discounts used in the order. Available if the relation `discounts` is expanded.", - "items": { - "type": "object", - "description": "A discount object." - } - }, - "gift_cards": { - "type": "array", - "description": "The gift cards used in the order. Available if the relation `gift_cards` is expanded.", - "items": { - "type": "object", - "description": "A gift card object." - } - }, - "shipping_methods": { - "type": "array", - "description": "The shipping methods used in the order. Available if the relation `shipping_methods` is expanded.", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "payments": { - "type": "array", - "description": "The payments used in the order. Available if the relation `payments` is expanded.", - "items": { - "$ref": "#/components/schemas/payment" - } - }, - "fulfillments": { - "type": "array", - "description": "The fulfillments used in the order. Available if the relation `fulfillments` is expanded.", - "items": { - "$ref": "#/components/schemas/fulfillment" - } - }, - "returns": { - "type": "array", - "description": "The returns associated with the order. Available if the relation `returns` is expanded.", - "items": { - "type": "object", - "description": "A return object." - } - }, - "claims": { - "type": "array", - "description": "The claims associated with the order. Available if the relation `claims` is expanded.", - "items": { - "type": "object", - "description": "A claim order object." - } - }, - "refunds": { - "type": "array", - "description": "The refunds associated with the order. Available if the relation `refunds` is expanded.", - "items": { - "type": "object", - "description": "A refund object." - } - }, - "swaps": { - "type": "array", - "description": "The swaps associated with the order. Available if the relation `swaps` is expanded.", - "items": { - "type": "object", - "description": "A swap object." - } - }, - "draft_order_id": { - "type": "string", - "description": "The ID of the draft order this order is associated with.", - "example": null - }, - "draft_order": { - "description": "A draft order object. Available if the relation `draft_order` is expanded.", - "type": "object" - }, - "items": { - "type": "array", - "description": "The line items that belong to the order. Available if the relation `items` is expanded.", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "gift_card_transactions": { - "type": "array", - "description": "The gift card transactions used in the order. Available if the relation `gift_card_transactions` is expanded.", - "items": { - "$ref": "#/components/schemas/gift_card_transaction" - } - }, - "canceled_at": { - "type": "string", - "description": "The date the order was canceled on.", - "format": "date-time" - }, - "no_notification": { - "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the processing of the order in case of failure.", - "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.", - "type": "string", - "example": null - }, - "sales_channel_id": { - "type": "string", - "description": "The ID of the sales channel this order is associated with.", - "example": null - }, - "sales_channel": { - "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", - "type": "object" - }, - "shipping_total": { - "type": "integer", - "description": "The total of shipping", - "example": 1000 - }, - "discount_total": { - "type": "integer", - "description": "The total of discount", - "example": 800 - }, - "tax_total": { - "type": "integer", - "description": "The total of tax", - "example": 0 - }, - "refunded_total": { - "type": "integer", - "description": "The total amount refunded if the order is returned.", - "example": 0 - }, - "total": { - "type": "integer", - "description": "The total amount of the order", - "example": 8200 - }, - "subtotal": { - "type": "integer", - "description": "The subtotal of the order", - "example": 8000 - }, - "paid_total": { - "type": "integer", - "description": "The total amount paid", - "example": 8000 - }, - "refundable_amount": { - "type": "integer", - "description": "The amount that can be refunded", - "example": 8200 - }, - "gift_card_total": { - "type": "integer", - "description": "The total of gift cards", - "example": 0 - }, - "gift_card_tax_total": { - "type": "integer", - "description": "The total of gift cards with taxes", - "example": 0 - } - } - }, - "payment_provider": { - "title": "Payment Provider", - "description": "Represents a Payment Provider plugin and holds its installation status.", - "x-resourceId": "payment_provider", - "required": [ - "id" - ], - "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 - } - } - }, - "payment_session": { - "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.", - "x-resourceId": "payment_session", - "required": [ - "cart_id", - "provider_id", - "status" - ], - "properties": { - "id": { - "type": "string", - "description": "The payment session's ID", - "example": "ps_01G901XNSRM2YS3ASN9H5KG3FZ" - }, - "cart_id": { - "description": "The id of the Cart that the Payment Session is created for.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "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.", - "type": "boolean", - "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": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a cart in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - }, - "payment": { - "title": "Payment", - "description": "Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded.", - "x-resourceId": "payment", - "required": [ - "amount", - "currency_code", - "provider_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The payment's ID", - "example": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE" - }, - "swap_id": { - "description": "The ID of the Swap that the Payment is used for.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "cart_id": { - "description": "The id of the Cart that the Payment Session is created for.", - "type": "string" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The ID of the Order that the Payment is used for.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/currency" - }, - "amount_refunded": { - "description": "The amount of the original Payment amount that has been refunded back to the Customer.", - "type": "integer", - "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.", - "type": "string", - "format": "date-time" - }, - "canceled_at": { - "description": "The date with timezone at which the Payment was canceled.", - "type": "string", - "format": "date-time" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a payment in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "price_list": { - "title": "Price List", - "description": "Price Lists represents a set of prices that overrides the default price for one or more product variants.", - "x-resourceId": "price_list", - "required": [ - "name", - "description" - ], - "properties": { - "id": { - "type": "string", - "description": "The price list's ID", - "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" - }, - "name": { - "type": "string", - "description": "The price list's name", - "example": "VIP Prices" - }, - "description": { - "type": "string", - "description": "The price list's description", - "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.", - "type": "string", - "format": "date-time" - }, - "ends_at": { - "description": "The date with timezone that the Price List stops being valid.", - "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": { - "type": "object", - "description": "A customer group object." - } - }, - "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/money_amount" - } - }, - "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" - } - } - }, - "product_collection": { - "title": "Product Collection", - "description": "Product Collections represents a group of Products that are related.", - "x-resourceId": "product_collection", - "required": [ - "title" - ], - "properties": { - "id": { - "type": "string", - "description": "The product collection's ID", - "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.", - "type": "string", - "example": "summer-collection" - }, - "products": { - "description": "The Products contained in the Product Collection. Available if the relation `products` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product collection object." - } - }, - "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" - } - } - } - }, - "product_option_value": { - "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.", - "x-resourceId": "product_option_value", - "required": [ - "value", - "option_id", - "variant_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The product option value's ID", - "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.", - "$ref": "#/components/schemas/product_option" - }, - "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.", - "$ref": "#/components/schemas/product_variant" - }, - "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" - } - } - } - }, - "product_option": { - "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.", - "x-resourceId": "product_option", - "required": [ - "title", - "product_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The product option's ID", - "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/product_option_value" - } - }, - "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.", - "type": "object" - }, - "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" - } - } - } - }, - "product_tag": { - "title": "Product Tag", - "description": "Product Tags can be added to Products for easy filtering and grouping.", - "x-resourceId": "product_tag", - "required": [ - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The product tag's ID", - "example": "ptag_01G8K2MTMG9168F2B70S1TAVK3" - }, - "value": { - "description": "The value that the Product Tag represents", - "type": "string", - "example": "Pants" - }, - "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" - } - } - } - }, - "product_tax_rate": { - "title": "Product Tax Rate", - "description": "Associates a tax rate with a product to indicate that the product is taxed in a certain way", - "x-resourceId": "product_tax_rate", - "required": [ - "product_id", - "rate_id" - ], - "properties": { - "product_id": { - "description": "The ID of the Product", - "type": "string", - "example": "prod_01G1G5V2MBA328390B5AXJ610F" - }, - "product": { - "description": "Available if the relation `product` is expanded.", - "$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.", - "$ref": "#/components/schemas/tax_rate" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "product_type_tax_rate": { - "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", - "x-resourceId": "product_type_tax_rate", - "required": [ - "product_type_id", - "rate_id" - ], - "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.", - "$ref": "#/components/schemas/product_type" - }, - "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.", - "$ref": "#/components/schemas/tax_rate" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "product_type": { - "title": "Product Type", - "description": "Product Type can be added to Products for filtering and reporting purposes.", - "x-resourceId": "product_type", - "required": [ - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The product type's ID", - "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" - }, - "value": { - "description": "The value that the Product Type represents.", - "type": "string", - "example": "Clothing" - }, - "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" - } - } - } - }, - "product_variant": { - "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.", - "x-resourceId": "product_variant", - "required": [ - "title", - "product_id", - "inventory_quantity" - ], - "properties": { - "id": { - "type": "string", - "description": "The product variant's ID", - "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.", - "type": "object" - }, - "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/money_amount" - } - }, - "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.", - "type": "string", - "example": "shirt-123" - }, - "barcode": { - "description": "A generic field for a GTIN number that can be used to identify the Product Variant.", - "type": "string", - "example": null - }, - "ean": { - "description": "An EAN barcode number that can be used to identify the Product Variant.", - "type": "string", - "example": null - }, - "upc": { - "description": "A UPC barcode number that can be used to identify the Product Variant.", - "type": "string", - "example": null - }, - "variant_rank": { - "description": "The ranking of this variant", - "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.", - "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.", - "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.", - "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.", - "type": "string", - "example": null - }, - "weight": { - "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "height": { - "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "width": { - "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "length": { - "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "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/product_option_value" - } - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "product", - "required": [ - "title", - "profile_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The product's ID", - "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.", - "type": "string" - }, - "description": { - "description": "A short description of the Product.", - "type": "string", - "example": "Every programmer's best friend." - }, - "handle": { - "description": "A unique identifier for the Product (e.g. for slug structure).", - "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.", - "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/product_option" - } - }, - "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/product_variant" - } - }, - "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.", - "$ref": "#/components/schemas/shipping_profile" - }, - "weight": { - "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "height": { - "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "width": { - "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "length": { - "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "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.", - "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.", - "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.", - "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.", - "type": "string", - "example": null - }, - "collection_id": { - "type": "string", - "description": "The Product Collection that the Product belongs to", - "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" - }, - "collection": { - "description": "A product collection object. Available if the relation `collection` is expanded.", - "type": "object" - }, - "type_id": { - "type": "string", - "description": "The Product type that the Product belongs to", - "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" - }, - "type": { - "description": "Available if the relation `type` is expanded.", - "$ref": "#/components/schemas/product_type" - }, - "tags": { - "description": "The Product Tags assigned to the Product. Available if the relation `tags` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/product_tag" - } - }, - "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", - "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": { - "type": "object", - "description": "A sales channel object." - } - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "refund", - "required": [ - "order_id", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The refund's ID", - "example": "ref_01G1G5V27GYX4QXNARRQCW1N8T" - }, - "order_id": { - "description": "The id of the Order that the Refund is related to.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "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.", - "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": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the refund in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "region", - "required": [ - "name", - "currency_code", - "tax_rate" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "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.", - "$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/tax_rate" - } - }, - "tax_code": { - "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.", - "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": { - "type": "string", - "description": "The ID of the tax provider used in this region", - "example": null - }, - "tax_provider": { - "description": "Available if the relation `tax_provider` is expanded.", - "$ref": "#/components/schemas/tax_provider" - }, - "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/payment_provider" - } - }, - "fulfillment_providers": { - "description": "The Fulfillment Providers that can be used to fulfill orders in the Region. Available if the relation `payment_providers` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/fulfillment_provider" - } - }, - "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" - } - } - } - }, - "return_item": { - "title": "Return Item", - "description": "Correlates a Line Item with a Return, keeping track of the quantity of the Line Item that will be returned.", - "x-resourceId": "return_item", - "required": [ - "return_id", - "item_id" - ], - "properties": { - "return_id": { - "description": "The id of the Return that the Return Item belongs to.", - "type": "string", - "example": "ret_01F0YET7XPCMF8RZ0Y151NZV2V" - }, - "return_order": { - "description": "Available if the relation `return_order` is expanded.", - "$ref": "#/components/schemas/return" - }, - "item_id": { - "description": "The id of the Line Item that the Return Item references.", - "type": "string", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "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.", - "type": "integer", - "example": 1 - }, - "recieved_quantity": { - "description": "The quantity that was received in the warehouse.", - "type": "integer", - "example": 1 - }, - "reason_id": { - "description": "The ID of the reason for returning the item.", - "type": "string", - "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" - }, - "reason": { - "description": "Available if the relation `reason` is expanded.", - "$ref": "#/components/schemas/return_reason" - }, - "note": { - "description": "An optional note with additional details about the Return.", - "type": "string", - "example": "I didn't like it." - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "return_reason": { - "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.", - "x-resourceId": "return_reason", - "required": [ - "value", - "label" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" - }, - "description": { - "description": "A description of the Reason.", - "type": "string", - "example": "Items that are damaged" - }, - "label": { - "description": "A text that can be displayed to the Customer as a reason.", - "type": "string", - "example": "Damaged goods" - }, - "value": { - "description": "The value to identify the reason by.", - "type": "string", - "example": "damaged" - }, - "parent_return_reason_id": { - "type": "string", - "description": "The ID of the parent reason.", - "example": null - }, - "parent_return_reason": { - "description": "Available if the relation `parent_return_reason` is expanded.", - "$ref": "#/components/schemas/return_reason" - }, - "return_reason_children": { - "description": "Available if the relation `return_reason_children` is expanded.", - "$ref": "#/components/schemas/return_reason" - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "return", - "required": [ - "refund_amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The return's ID", - "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/return_item" - } - }, - "swap_id": { - "description": "The ID of the Swap that the Return is a part of.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The ID of the Order that the Return is made from.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "claim_order_id": { - "description": "The ID of the Claim that the Return is a part of.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "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.", - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "shipping_data": { - "description": "Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment.", - "type": "object", - "example": {} - }, - "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.", - "type": "boolean", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the return in case of failure.", - "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.", - "type": "string", - "format": "date-time" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "sales_channel": { - "title": "Sales Channel", - "description": "A Sales Channel", - "x-resourceId": "sales_channel", - "required": [ - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The sales channel's ID", - "example": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A" - }, - "name": { - "description": "The name of the sales channel.", - "type": "string", - "example": "Market" - }, - "description": { - "description": "The description of the sales channel.", - "type": "string", - "example": "Multi-vendor market" - }, - "is_disabled": { - "description": "Specify if the sales channel is enabled or disabled.", - "type": "boolean", - "default": false - }, - "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" - } - } - }, - "shipping_method_tax_line": { - "title": "Shipping Method Tax Line", - "description": "Shipping Method Tax Line", - "x-resourceId": "shipping_method_tax_line", - "required": [ - "shipping_method_id", - "rate", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The line item tax line's ID", - "example": "smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" - }, - "shipping_method_id": { - "type": "string", - "description": "The ID of the line item", - "example": "sm_01F0YET7DR2E7CYVSDHM593QG2" - }, - "shipping_method": { - "description": "Available if the relation `shipping_method` is expanded.", - "$ref": "#/components/schemas/shipping_method" - }, - "code": { - "description": "A code to identify the tax type by", - "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": { - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "shipping_method": { - "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.", - "x-resourceId": "shipping_method", - "required": [ - "shipping_option_id", - "price" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping method's ID", - "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" - }, - "shipping_option": { - "description": "Available if the relation `shipping_option` is expanded.", - "$ref": "#/components/schemas/shipping_option" - }, - "order_id": { - "description": "The id of the Order that the Shipping Method is used on.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "return_id": { - "description": "The id of the Return that the Shipping Method is used on.", - "type": "string", - "example": null - }, - "return_order": { - "description": "A return object. Available if the relation `return_order` is expanded.", - "type": "object" - }, - "swap_id": { - "description": "The id of the Swap that the Shipping Method is used on.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "cart_id": { - "description": "The id of the Cart that the Shipping Method is used on.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "claim_order_id": { - "description": "The id of the Claim that the Shipping Method is used on.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "tax_lines": { - "type": "array", - "description": "Available if the relation `tax_lines` is expanded.", - "items": { - "$ref": "#/components/schemas/shipping_method_tax_line" - } - }, - "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": {} - } - } - }, - "shipping_option_requirement": { - "title": "Shipping Option Requirement", - "description": "A requirement that a Cart must satisfy for the Shipping Option to be available to the Cart.", - "x-resourceId": "shipping_option_requirement", - "required": [ - "shipping_option_id", - "type", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping option requirement's ID", - "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.", - "$ref": "#/components/schemas/shipping_option" - }, - "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": { - "type": "string", - "description": "The date with timezone at which the resource was deleted.", - "format": "date-time" - } - } - }, - "shipping_option": { - "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.", - "x-resourceId": "shipping_option", - "required": [ - "name", - "region_id", - "profile_id", - "provider_id", - "price_type" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping option's ID", - "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": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/shipping_profile" - }, - "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.", - "$ref": "#/components/schemas/fulfillment_provider" - }, - "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`.", - "type": "integer", - "example": 200 - }, - "is_return": { - "description": "Flag to indicate if the Shipping Option can be used for Return shipments.", - "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/shipping_option_requirement" - } - }, - "data": { - "description": "The data needed for the Fulfillment Provider to identify the Shipping Option.", - "type": "object", - "example": {} - }, - "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" - } - } - } - }, - "shipping_profile": { - "title": "Shipping Profile", - "description": "Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products.", - "x-resourceId": "shipping_profile", - "required": [ - "name", - "type" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping profile's ID", - "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": { - "type": "object", - "description": "A product object." - } - }, - "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/shipping_option" - } - }, - "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" - } - } - } - }, - "shipping_tax_rate": { - "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", - "x-resourceId": "shipping_tax_rate", - "required": [ - "shipping_option_id", - "rate_id" - ], - "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.", - "$ref": "#/components/schemas/shipping_option" - }, - "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.", - "$ref": "#/components/schemas/tax_rate" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "staged_job": { - "title": "Staged Job", - "description": "A staged job resource", - "x-resourceId": "staged_job", - "required": [ - "event_name" - ], - "properties": { - "id": { - "type": "string", - "description": "The staged job's ID", - "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": {} - } - } - }, - "store": { - "title": "Store", - "description": "Holds settings for the Store, such as name, currencies, etc.", - "x-resourceId": "store", - "properties": { - "id": { - "type": "string", - "description": "The store's ID", - "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.", - "$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.", - "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.", - "type": "string", - "example": null - }, - "invite_link_template": { - "description": "A template to generate Invite links from", - "type": "string", - "example": null - }, - "default_sales_channel_id": { - "type": "string", - "description": "The sales channel ID the cart is associated with.", - "example": null - }, - "default_sales_channel": { - "description": "A sales channel object. Available if the relation `default_sales_channel` is expanded.", - "type": "object" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "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.", - "x-resourceId": "swap", - "required": [ - "fulfillment_status", - "payment_status", - "order_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The swap's ID", - "example": "swap_01F0YET86Y9G92D3YDR9Y6V676" - }, - "fulfillment_status": { - "description": "The status of the Fulfillment of the Swap.", - "type": "string", - "enum": [ - "not_fulfilled", - "fulfilled", - "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.", - "type": "object" - }, - "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/line_item" - } - }, - "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.", - "type": "object" - }, - "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.", - "$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.", - "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.", - "type": "string", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_methods": { - "description": "The Shipping Methods used to fulfill the addtional items purchased. Available if the relation `shipping_methods` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "cart_id": { - "description": "The id of the Cart that the Customer will use to confirm the Swap.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "allow_backorder": { - "description": "If true, swaps can be completed with items out of stock", - "type": "boolean", - "default": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the swap in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "confirmed_at": { - "description": "The date with timezone at which the Swap was confirmed by the Customer.", - "type": "string", - "format": "date-time" - }, - "canceled_at": { - "description": "The date with timezone at which the Swap was canceled.", - "type": "string", - "format": "date-time" - }, - "no_notification": { - "description": "If set to true, no notification will be sent related to this swap", - "type": "boolean", - "example": false - }, - "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" - } - } - } - }, - "tax_line": { - "title": "Tax Line", - "description": "Line item that specifies an amount of tax to add to a line item.", - "x-resourceId": "tax_line", - "required": [ - "rate", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The tax line's ID", - "example": "tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" - }, - "code": { - "description": "A code to identify the tax type by", - "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": { - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "tax_provider": { - "title": "Tax Provider", - "description": "The tax service used to calculate taxes", - "x-resourceId": "tax_provider", - "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 - } - } - }, - "tax_rate": { - "title": "Tax Rate", - "description": "A Tax Rate can be used to associate a certain rate to charge on products within a given Region", - "x-resourceId": "line_item", - "required": [ - "name", - "region_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The tax rate's ID", - "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" - }, - "rate": { - "description": "The numeric rate to charge", - "type": "number", - "example": 10 - }, - "code": { - "description": "A code to identify the tax type by", - "type": "string", - "example": "tax01" - }, - "name": { - "description": "A human friendly name for the tax", - "type": "string", - "example": "Tax Example" - }, - "region_id": { - "type": "string", - "description": "The id of the Region that the rate belongs to", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "products": { - "type": "array", - "description": "The products that belong to this tax rate. Available if the relation `products` is expanded.", - "items": { - "type": "object", - "description": "A product object." - } - }, - "product_types": { - "type": "array", - "description": "The product types that belong to this tax rate. Available if the relation `product_types` is expanded.", - "items": { - "type": "object", - "description": "A product type object." - } - }, - "shipping_options": { - "type": "array", - "description": "The shipping options that belong to this tax rate. Available if the relation `shipping_options` is expanded.", - "items": { - "type": "object", - "description": "A shipping option object." - } - }, - "product_count": { - "description": "The count of products", - "type": "integer", - "example": null - }, - "product_type_count": { - "description": "The count of product types", - "type": "integer", - "example": null - }, - "shipping_option_count": { - "description": "The count of shipping options", - "type": "integer", - "example": null - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "tracking_link": { - "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.", - "x-resourceId": "tracking_link", - "required": [ - "tracking_number", - "fulfillment_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The tracking link's ID", - "example": "tlink_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "url": { - "description": "The URL at which the status of the shipment can be tracked.", - "type": "string", - "format": "uri" - }, - "tracking_number": { - "description": "The tracking number given by the shipping carrier.", - "type": "string", - "format": "RH370168054CN" - }, - "fulfillment_id": { - "type": "string", - "description": "The id of the Fulfillment that the Tracking Link references.", - "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" - }, - "fulfillment": { - "description": "Available if the relation `fulfillment` is expanded.", - "$ref": "#/components/schemas/fulfillment" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a process in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "user": { - "title": "User", - "description": "Represents a User who can manage store settings.", - "x-resourceId": "user", - "required": [ - "email" - ], - "properties": { - "id": { - "type": "string", - "description": "The user's ID", - "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" - }, - "email": { - "description": "The email of the User", - "type": "string", - "format": "email" - }, - "first_name": { - "description": "The first name of the User", - "type": "string", - "example": "Levi" - }, - "last_name": { - "description": "The last name of the User", - "type": "string", - "example": "Bogan" - }, - "api_token": { - "description": "An API token associated with the user.", - "type": "string", - "example": null - }, - "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" - } - } - } - } - } - } -} \ No newline at end of file + }) + + .then(({ return }) => { + console.log(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: + properties: + return: + $ref: '#/components/schemas/return' + '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: Assign a batch of product to a sales channel + 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: + 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 + 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: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + '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: Remove a list of products from a sales channel + 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: + 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 + 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: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + '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: + 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 + 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: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + '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-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: + properties: + sales_channels: + type: array + items: + $ref: '#/components/schemas/sales_channel' + 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 + '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-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: + 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 + '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: Retrieve 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-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: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + '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: + 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. + 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: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + '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: + 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: + 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 + 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: + properties: + shipping_option: + $ref: '#/components/schemas/shipping_option' + '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-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: + properties: + shipping_options: + type: array + items: + $ref: '#/components/schemas/shipping_option' + count: + type: integer + description: The total number of items available + '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-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: + 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 + '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: Retrieve 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-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: + properties: + shipping_option: + $ref: '#/components/schemas/shipping_option' + '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: + 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: + 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 + 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: + properties: + shipping_option: + $ref: '#/components/schemas/shipping_option' + '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: + required: + - name + properties: + name: + description: The name of the Shipping Profile + 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.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: + properties: + shipping_profile: + $ref: '#/components/schemas/shipping_profile' + '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-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: + properties: + shipping_profiles: + type: array + items: + $ref: '#/components/schemas/shipping_profile' + '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-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: + 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 + '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: Retrieve 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-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: + properties: + shipping_profile: + $ref: '#/components/schemas/shipping_profile' + '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 Profiles + 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: + properties: + name: + description: The name of the Shipping Profile + 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.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: + properties: + shipping_profile: + $ref: '#/components/schemas/shipping_profile' + '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-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: + properties: + store: + $ref: '#/components/schemas/store' + '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: Remove 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-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: + properties: + store: + $ref: '#/components/schemas/store' + '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: Retrieve Store details. + description: Retrieves the Store details + x-authenticated: true + 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: + properties: + store: + $ref: '#/components/schemas/store' + '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: + 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 + 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: + properties: + store: + $ref: '#/components/schemas/store' + '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: Retrieve configured Payment Providers + description: Retrieves the configured Payment Providers + x-authenticated: true + 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: + properties: + payment_providers: + type: array + items: + $ref: '#/components/schemas/payment_provider' + '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: Retrieve configured Tax Providers + description: Retrieves the configured Tax Providers + x-authenticated: true + 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: + properties: + tax_providers: + type: array + items: + $ref: '#/components/schemas/tax_provider' + '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: Retrieve 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-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: + properties: + swap: + $ref: '#/components/schemas/swap' + '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-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: + 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 + '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 Tax Rate 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: + 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 + 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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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: Remove Tax Rate 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: + 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 + 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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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 Tax Rate 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: + required: + - products + properties: + products: + type: array + description: The IDs of the products to associate with this tax rate + items: + 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.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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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: Removes Tax Rate 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: + required: + - products + properties: + products: + type: array + description: >- + The IDs of the products to remove association with this tax + rate + items: + 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.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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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 Tax Rate to Product Types + 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: + required: + - shipping_options + properties: + shipping_options: + type: array + description: >- + The IDs of the shipping options to associate with this tax + rate + items: + 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.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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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: Removes a Tax Rate 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: + 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 + 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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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: + 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 + 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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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-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: + properties: + tax_rates: + type: array + items: + $ref: '#/components/schemas/tax_rate' + 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 + '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-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: + 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 + '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 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-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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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: + 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 + 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: + properties: + tax_rate: + $ref: '#/components/schemas/tax_rate' + '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: Uploads a file + description: Uploads a 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' \ + + --data-binary '{file_path}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Upload + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + uploads: + type: array + items: + type: object + properties: + url: + type: string + description: The URL of the uploaded file. + format: uri + '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: + 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 + 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: + properties: + user: + $ref: '#/components/schemas/user' + '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: Retrieve all users + description: Retrieves all users. + x-authenticated: true + 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: + properties: + users: + type: array + items: + $ref: '#/components/schemas/user' + '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-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: + - Users + responses: + '200': + description: OK + content: + application/json: + schema: + 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 + '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: Retrieve 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-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: + properties: + user: + $ref: '#/components/schemas/user' + '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: + 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 + 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: + properties: + user: + $ref: '#/components/schemas/user' + '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: Generate a password token for a User. + description: Generates a password token for a User with a given email. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - email + properties: + email: + description: The Users email. + type: string + format: email + 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: Set the password for a User. + description: Sets the password for a User given the correct token. + x-authenticated: true + requestBody: + content: + application/json: + schema: + 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 + 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: + properties: + user: + $ref: '#/components/schemas/user' + '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: q + description: Query used for searching variants. + schema: + type: string + - in: query + name: offset + description: How many variants to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of variants 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.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: + properties: + variants: + type: array + items: + $ref: '#/components/schemas/product_variant' + 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 + '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/multiple_errors' + examples: + not_allowed: + $ref: '#/components/examples/not_allowed_error' + invalid_data: + $ref: '#/components/examples/invalid_data_error' + multiple_errors: + $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 -U + + UPDATE public.user SET api_token='' WHERE + email=''; + + ``` + + + Where: + + - `` is the name of the database schema you use for the Medusa + server. + + - `` is the name of the user that has privileges over the + database schema. + + - `` is the API token you want to associate with the user. + You can use [this tool to generate a random + token](https://randomkeygen.com/). + + - `` 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 alternatively following along with the JS Client request + samples, you must provide the `apiKey` option when creating the Medusa + client: + + + ```js + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3, + 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: + address: + title: Address + description: An address. + x-resourceId: address + properties: + id: + type: string + description: ID of the address + example: addr_01G8ZC9VS1XVE149MGH2J7QSSH + customer_id: + type: string + description: ID of the customer this address belongs to + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: Available if the relation `customer` is expanded. + type: array + items: + type: object + description: A customer object. + 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 + country: + description: A country object. Available if the relation `country` is expanded. + type: object + province: + type: string + description: Province + example: Kentucky + postal_code: + type: string + description: Postal Code + example: 72093 + phone: + type: string + description: Phone Number + 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: + 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 + batch_job: + title: Batch Job + description: A Batch Job. + x-resourceId: batch_job + required: + - type + properties: + id: + type: string + description: The unique identifier for the batch job. + example: batch_01G8T782965PYFG0751G0Z38B4 + type: + type: string + description: The type of batch job. + enum: + - product-import + - product-export + status: + type: string + description: The status of the batch job. + enum: + - created + - pre_processed + - confirmed + - processing + - completed + - canceled + - failed + default: created + created_by: + type: string + description: The unique identifier of the user that created the batch job. + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + created_by_user: + description: >- + A user object. Available if the relation `created_by_user` is + expanded. + type: object + context: + type: object + description: >- + The context of the batch job, the type of the batch job determines + what the context should contain. + 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: Specify if the job must apply the modifications or not. + default: false + result: + type: object + description: The result of the batch job. + 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: + type: string + description: The date from which the job has been pre processed. + format: date-time + processing_at: + type: string + description: The date the job is processing at. + format: date-time + confirmed_at: + type: string + description: The date when the confirmation has been done. + format: date-time + completed_at: + type: string + description: The date of the completion. + format: date-time + canceled_at: + type: string + description: The date of the concellation. + format: date-time + failed_at: + type: string + description: The date when the job failed. + format: date-time + 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 last updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + cart: + title: Cart + description: Represents a user cart + x-resourceId: cart + properties: + id: + type: string + description: The cart's ID + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + email: + type: string + description: The email associated with the cart + format: email + billing_address_id: + type: string + description: The billing address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_address_id: + type: string + description: The shipping address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + items: + description: Available if the relation `items` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item' + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + discounts: + type: array + description: Available if the relation `discounts` is expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: Available if the relation `gift_cards` is expanded. + items: + type: object + description: A gift card object. + customer_id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + payment_session: + description: The selected payment session in the cart. + $ref: '#/components/schemas/payment_session' + payment_sessions: + type: array + description: The payment sessions created on the cart. + items: + $ref: '#/components/schemas/payment_session' + payment_id: + type: string + description: The payment's ID if available + example: pay_01G8ZCC5W42ZNY842124G7P5R9 + payment: + description: Available if the relation `payment` is expanded. + $ref: '#/components/schemas/payment' + shipping_methods: + type: array + description: The shipping methods added to the cart. + items: + $ref: '#/components/schemas/shipping_method' + type: + type: string + description: The cart's type. + enum: + - default + - swap + - draft_order + - payment_link + - claim + default: default + completed_at: + type: string + description: The date with timezone at which the cart was completed. + format: date-time + payment_authorized_at: + type: string + description: The date with timezone at which the payment was authorized. + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + context: + type: object + description: >- + The context of the cart which can include info like IP or user + agent. + example: + ip: '::1' + user_agent: PostmanRuntime/7.29.2 + sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + 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 + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: >- + The total amount refunded if the order associated with this cart is + returned. + example: 0 + total: + type: integer + description: The total amount of the cart + example: 8200 + subtotal: + type: integer + description: The subtotal of the cart + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 + claim_image: + title: Claim Image + description: Represents photo documentation of a claim. + x-resourceId: claim_image + required: + - claim_item_id + - url + properties: + id: + type: string + description: The claim image's ID + example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 + claim_item_id: + type: string + description: The ID of the claim item associated with the image + claim_item: + description: >- + A claim item object. Available if the relation `claim_item` is + expanded. + type: object + url: + type: string + description: The URL of the image + format: uri + 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 + claim_item: + title: Claim Item + description: >- + Represents a claimed item along with information about the reasons for + the claim. + x-resourceId: claim_item + required: + - claim_order_id + - item_id + - variant_id + - reason + - quantity + properties: + id: + type: string + description: The claim item's ID + example: citm_01G8ZH853Y6TFXWPG5EYE81X63 + images: + type: array + description: Available if the relation `images` is expanded. + items: + $ref: '#/components/schemas/claim_image' + 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. + type: object + 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. + $ref: '#/components/schemas/line_item' + 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. + type: object + 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' + 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/claim_tag' + 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 + claim_order: + 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. + x-resourceId: claim_order + required: + - type + - order_id + properties: + id: + type: string + description: The claim's ID + example: claim_01G8ZH853Y6TFXWPG5EYE81X63 + type: + type: string + enum: + - refund + - replace + payment_status: + type: string + description: The status of the claim's payment + enum: + - na + - not_refunded + - refunded + default: na + 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/claim_item' + 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/line_item' + 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. + type: object + 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 + type: object + shipping_address_id: + description: The ID of the address that the new items should be shipped to + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + shipping_methods: + description: The shipping methods that the claim order will be shipped with. + type: array + items: + $ref: '#/components/schemas/shipping_method' + 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 + type: integer + example: 1000 + canceled_at: + description: The date with timezone at which the claim was canceled. + type: string + format: date-time + 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 + no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the claim in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + claim_tag: + title: Claim Tag + description: >- + Claim Tags are user defined tags that can be assigned to claim items for + easy filtering and grouping. + x-resourceId: claim_tag + required: + - value + properties: + id: + type: string + description: The claim tag's ID + example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 + value: + description: The value that the claim tag holds + type: string + example: Damaged + 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 + country: + title: Country + description: Country details + x-resourceId: country + required: + - iso_2 + - iso_3 + - num_code + - name + - display_name + properties: + id: + type: string + description: The country's ID + example: 109 + iso_2: + type: string + description: The 2 character ISO code of the country in lower case + 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: + type: string + description: The 2 character ISO code of the country in lower case + 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: + type: string + description: The region ID this country is associated with. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + currency: + title: Currency + description: Currency + x-resourceId: currency + required: + - code + - symbol + - symbol_native + - name + 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 + custom_shipping_option: + 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 + x-resourceId: custom_shipping_option + required: + - price + - shipping_option_id + properties: + id: + type: string + description: The custom shipping option's ID + 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. + type: object + cart_id: + description: The ID of the Cart that the custom shipping option is attached to + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + 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 + customer_group: + title: Customer Group + description: Represents a customer group + x-resourceId: customer_group + required: + - name + properties: + id: + type: string + description: The customer group's ID + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 + name: + type: string + description: The name of the customer group + example: VIP + customers: + type: array + description: >- + The customers that belong to the customer group. Available if the + relation `customers` is expanded. + items: + type: object + description: A customer object. + price_lists: + type: array + description: >- + The price lists that are associated with the customer group. + Available if the relation `price_lists` is expanded. + items: + $ref: '#/components/schemas/price_list' + 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 + customer: + title: Customer + description: Represents a customer + x-resourceId: customer + required: + - email + properties: + id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + email: + type: string + description: The customer's email + format: email + first_name: + type: string + description: The customer's first name + example: Arno + last_name: + type: string + description: The customer's first name + example: Willms + billing_address_id: + type: string + description: The customer's billing address ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_addresses: + description: Available if the relation `shipping_addresses` is expanded. + type: array + items: + $ref: '#/components/schemas/address' + phone: + type: string + description: The customer's phone number + example: 16128234334802 + has_account: + type: boolean + description: Whether the customer has an account or not + default: false + orders: + description: Available if the relation `orders` is expanded. + type: array + items: + type: object + description: An order object. + groups: + description: >- + The customer groups the customer belongs to. Available if the + relation `groups` is expanded. + type: array + items: + $ref: '#/components/schemas/customer_group' + 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 + discount_condition_customer_group: + title: Product Tag Discount Condition + description: Associates a discount condition with a customer group + x-resourceId: discount_condition_customer_group + required: + - customer_group_id + - condition_id + 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. + $ref: '#/components/schemas/customer_group' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product_collection: + title: Product Collection Discount Condition + description: Associates a discount condition with a product collection + x-resourceId: discount_condition_product_collection + required: + - product_collection_id + - condition_id + 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. + $ref: '#/components/schemas/product_collection' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product_tag: + title: Product Tag Discount Condition + description: Associates a discount condition with a product tag + x-resourceId: discount_condition_product_tag + required: + - product_tag_id + - condition_id + 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. + $ref: '#/components/schemas/product_tag' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product_type: + title: Product Type Discount Condition + description: Associates a discount condition with a product type + x-resourceId: discount_condition_product + required: + - product_type_id + - condition_id + 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. + $ref: '#/components/schemas/product_type' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product: + title: Product Discount Condition + description: Associates a discount condition with a product + x-resourceId: discount_condition_product + required: + - product_id + - condition_id + 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. + $ref: '#/components/schemas/product' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition: + title: Discount Condition + description: Holds rule conditions for when a discount is applicable + x-resourceId: discount_condition + required: + - type + - operator + - discount_rule_id + properties: + id: + type: string + description: The discount condition's ID + 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: + type: string + description: The ID of the discount rule associated with the condition + example: dru_01F0YESMVK96HVX7N419E3CJ7C + discount_rule: + description: Available if the relation `discount_rule` is expanded. + $ref: '#/components/schemas/discount_rule' + products: + description: >- + products associated with this condition if type = products. + Available if the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + product_types: + description: >- + product types associated with this condition if type = + product_types. Available if the relation `product_types` is + expanded. + type: array + items: + type: object + description: A product type object. + product_tags: + description: >- + product tags associated with this condition if type = product_tags. + Available if the relation `product_tags` is expanded. + type: array + items: + type: object + description: A product tag object. + product_collections: + description: >- + product collections associated with this condition if type = + product_collections. Available if the relation `product_collections` + is expanded. + type: array + items: + type: object + description: A product collection object. + customer_groups: + description: >- + customer groups associated with this condition if type = + customer_groups. Available if the relation `customer_groups` is + expanded. + type: array + items: + type: object + description: A customer group object. + 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 + discount_rule: + title: Discount Rule + description: >- + Holds the rules that governs how a Discount is calculated when applied + to a Cart. + x-resourceId: discount_rule + required: + - type + - value + properties: + id: + type: string + description: The discount rule's ID + 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 + 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. + 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: + type: object + description: A discount condition object. + 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 + discount: + title: Discount + description: >- + Represents a discount that can be applied to a cart for promotional + purposes. + x-resourceId: discount + required: + - code + - is_dynamic + properties: + id: + type: string + description: The discount's ID + 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: + type: string + description: The Discount Rule that governs the behaviour of the Discount + example: dru_01F0YESMVK96HVX7N419E3CJ7C + rule: + description: Available if the relation `rule` is expanded. + $ref: '#/components/schemas/discount_rule' + is_disabled: + description: >- + Whether the Discount has been disabled. Disabled discounts cannot be + applied to carts + type: boolean + example: false + parent_discount_id: + type: string + description: >- + The Discount that the discount was created from. This will always be + a dynamic discount + example: disc_01G8ZH853YPY9B94857DY91YGW + parent_discount: + description: Available if the relation `parent_discount` is expanded. + $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. + type: string + format: date-time + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S + regions: + description: >- + The Regions in which the Discount can be used. Available if the + relation `regions` is expanded. + type: array + items: + type: object + description: A region object. + usage_limit: + description: The maximum number of times that a discount can be used. + type: integer + example: 100 + usage_count: + description: The number of times a discount has been used. + type: integer + example: 50 + default: 0 + 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 + draft-order: + title: DraftOrder + description: Represents a draft order + x-resourceId: draft-order + properties: + id: + type: string + description: The draft order's ID + example: dorder_01G8TJFKBG38YYFQ035MSVG03C + status: + type: string + description: The status of the draft order + enum: + - open + - completed + default: open + display_id: + type: string + description: The draft order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the draft order. + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + type: string + description: The ID of the order associated with the draft order. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + canceled_at: + type: string + description: The date the draft order was canceled at. + format: date-time + completed_at: + type: string + description: The date the draft order was completed at. + format: date-time + no_notification_order: + type: boolean + description: Whether to send the customer notifications regarding order updates. + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the draft order in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + fulfillment_item: + title: Fulfillment Item + description: >- + Correlates a Line Item with a Fulfillment, keeping track of the quantity + of the Line Item. + x-resourceId: fulfillment_item + 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. + type: object + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + quantity: + description: The quantity of the Line Item that is included in the Fulfillment. + type: integer + example: 1 + fulfillment_provider: + title: Fulfillment Provider + description: >- + Represents a fulfillment provider plugin and holds its installation + status. + x-resourceId: fulfillment_provider + 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 + example: 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. + x-resourceId: fulfillment + required: + - provider_id + properties: + id: + type: string + description: The cart's ID + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + claim_order_id: + description: The id of the Claim that the Fulfillment belongs to. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + swap_id: + description: The id of the Swap that the Fulfillment belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The id of the Order that the Fulfillment belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + 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. + $ref: '#/components/schemas/fulfillment_provider' + 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/fulfillment_item' + 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/tracking_link' + tracking_numbers: + deprecated: true + description: >- + The tracking numbers that can be used to track the status of the + fulfillment. + 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. + type: string + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. + type: boolean + example: false + canceled_at: + description: The date with timezone at which the Fulfillment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the + fulfillment in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + gift_card_transaction: + title: Gift Card Transaction + description: >- + Gift Card Transactions are created once a Customer uses a Gift Card to + pay for their Order + x-resourceId: gift_card_transaction + required: + - gift_card_id + - amount + properties: + id: + type: string + description: The gift card transaction's ID + 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. + type: object + 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. + type: object + 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. + type: boolean + example: false + tax_rate: + description: The tax rate of the transaction + type: number + example: 0 + gift_card: + title: Gift Card + description: >- + Gift Cards are redeemable and represent a value that can be used towards + the payment of an Order. + x-resourceId: gift_card + required: + - code + - value + - balance + - region_id + properties: + id: + type: string + description: The cart's ID + 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: + type: string + description: The id of the Region in which the Gift Card is available. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + order_id: + type: string + description: The id of the Order that the Gift Card was purchased in. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + is_disabled: + description: >- + Whether the Gift Card has been disabled. Disabled Gift Cards cannot + be applied to carts. + type: boolean + example: false + ends_at: + description: The time at which the Gift Card can no longer be used. + type: string + format: date-time + 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 + idempotency_key: + title: Idempotency Key + description: >- + Idempotency Key is used to continue a process in case of any failure + that might occur. + x-resourceId: idempotency_key + required: + - idempotency_key + properties: + id: + type: string + description: The idempotency key's ID + 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. + type: string + format: date-time + request_method: + description: The method of the request + type: string + example: POST + request_params: + type: object + description: The parameters passed to the request + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + request_path: + description: The request's path + type: string + example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete + response_code: + type: string + description: The response's code. + example: 200 + response_body: + type: object + description: The response's body + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + recovery_point: + type: string + description: Where to continue from. + default: started + image: + title: Image + description: Images holds a reference to a URL at which the image file can be found. + x-resourceId: image + required: + - 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: + 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 + invite: + title: Invite + description: Represents an invite + x-resourceId: invite + required: + - user_email + properties: + id: + type: string + description: The invite's ID + example: invite_01G8TKE4XYCTHSCK2GDEP47RE1 + user_email: + type: string + description: The email of the user being invited. + format: email + role: + type: string + description: The user's role. + enum: + - admin + - member + - developer + default: member + accepted: + type: boolean + description: Whether the invite was accepted or not. + example: false + token: + type: string + description: The token used to accept the invite. + expores_at: + type: string + description: The date the invite expires at. + format: date-time + 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 + line_item_adjustment: + title: Line Item Adjustment + description: Represents an Line Item Adjustment + x-resourceId: line_item_adjustment + required: + - item_id + - description + - amount + properties: + id: + type: string + description: The invite's ID + example: lia_01G8TKE4XYCTHSCK2GDEP47RE1 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + description: + type: string + description: The line item's adjustment description + example: Adjusted item's price. + discount_id: + type: string + description: The ID of the discount associated with the adjustment + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + discount: + description: Available if the relation `discount` is expanded. + $ref: '#/components/schemas/discount' + amount: + type: number + description: The adjustment amount + example: 1000 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + line_item_tax_line: + title: Line Item Tax Line + description: Represents an Line Item Tax Line + x-resourceId: line_item_tax_line + required: + - item_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + code: + description: A code to identify the tax type by + 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: + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + line_item: + 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. + x-resourceId: line_item + required: + - title + - unit_price + - quantity + properties: + id: + type: string + description: The cart's ID + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + cart_id: + description: The ID of the Cart that the Line Item belongs to. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Line Item belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Line Item belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Line Item belongs to. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + description: Available if the relation `tax_lines` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_tax_line' + adjustments: + description: Available if the relation `adjustments` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_adjustment' + 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. + type: string + example: One Size + thumbnail: + description: A URL string to a small image of the contents of the Line Item. + 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 + example: false + is_giftcard: + description: Flag to indicate if the Line Item is a Gift Card. + type: boolean + example: 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 + example: false + allow_discounts: + description: >- + Flag to indicate if the Line Item should be included when doing + discount calculations. + type: boolean + example: false + has_shipping: + description: >- + Flag to indicate if the Line Item has fulfillment associated with + it. + 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: boolean + example: 8000 + variant_id: + description: The id of the Product Variant contained in the Line Item. + 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. + type: object + 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. + type: integer + example: 0 + returned_quantity: + description: The quantity of the Line Item that has been returned. + type: integer + example: 0 + shipped_quantity: + description: The quantity of the Line Item that has been shipped. + 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: + type: integer + description: The subtotal of the line item + example: 8000 + tax_total: + type: integer + description: The total of tax of the line item + example: 0 + total: + type: integer + description: The total amount of the line item + example: 8000 + original_total: + type: integer + description: The original total amount of the line item + example: 8000 + original_tax_total: + type: integer + description: The original tax total amount of the line item + example: 0 + discount_total: + type: integer + description: The total of discount of the line item + example: 0 + gift_card_total: + type: integer + description: The total of the gift card of the line item + example: 0 + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + money_amount: + 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. + x-resourceId: money_amount + required: + - currency_code + - amount + properties: + id: + type: string + description: The money amount's ID + 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. + $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. + 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. + type: integer + example: 1 + price_list_id: + type: string + description: The ID of the price list associated with the money amount + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + price_list: + description: Available if the relation `price_list` is expanded. + $ref: '#/components/schemas/price_list' + variant_id: + description: The id of the Product Variant contained in the Line Item. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + The Product Variant contained in the Line Item. Available if the + relation `variant` is expanded. + type: object + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + 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 + 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. + x-resourceId: note + required: + - value + - resource_type + - resource_id + properties: + id: + type: string + description: The note's ID + 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: + type: string + description: The ID of the author (user) + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + author: + description: Available if the relation `author` is expanded. + $ref: '#/components/schemas/user' + 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 + notification_provider: + title: Notification Provider + description: >- + Represents a notification provider plugin and holds its installation + status. + x-resourceId: notification_provider + required: + - id + 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. + x-resourceId: notification + required: + - resource_type + - resource_id + - to + properties: + id: + type: string + description: The notification's ID + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + event_name: + description: The name of the event that the notification was sent for. + 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. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + 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: {} + resends: + description: >- + The resends that have been completed after the original + Notification. + type: array + items: + $ref: '#/components/schemas/notification_resend' + provider_id: + description: The id of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' + 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 + notification_resend: + title: Notification Resend + description: A resend of a Notification. + x-resourceId: notification_resend + properties: + id: + description: The notification resend's ID + type: string + example: noti_01F0YET45G9NHP08Z66CE4QKBS + event_name: + description: The name of the event that the notification was sent for. + 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. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + 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 ID of the Notification that was originally sent. + type: string + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + parent_notification: + description: Available if the relation `parent_notification` is expanded. + $ref: '#/components/schemas/notification' + provider_id: + description: The ID of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' + 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 + OAuth: + title: OAuth + description: Represent an OAuth app + x-resourceId: OAuth + required: + - id + - display_name + - application_name + properties: + id: + type: string + description: The app's ID + example: example_app + display_name: + type: string + description: The app's display name + example: Example app + application_name: + type: string + description: The app's name + example: example + install_url: + type: string + description: The URL to install the app + format: uri + uninstall_url: + type: string + description: The URL to uninstall the app + format: uri + data: + type: object + description: Any data necessary to the app. + example: {} + order: + title: Order + description: Represents an order + x-resourceId: order + required: + - customer_id + - email + - region_id + - currency_code + properties: + id: + type: string + description: The order's ID + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + status: + type: string + description: The order's status + enum: + - pending + - completed + - archived + - canceled + - requires_action + default: pending + fulfillment_status: + type: string + description: The order's fulfillment status + enum: + - not_fulfilled + - partially_fulfilled + - fulfilled + - partially_shipped + - shipped + - partially_returned + - returned + - canceled + - requires_action + default: not_fulfilled + payment_status: + type: string + description: The order's payment status + enum: + - not_paid + - awaiting + - captured + - partially_refunded + - refuneded + - canceled + - requires_action + default: not_paid + display_id: + type: integer + description: The order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the order + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + customer_id: + type: string + description: The ID of the customer associated with the order + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + email: + description: The email associated with the order + type: string + format: email + billing_address_id: + type: string + description: The ID of the billing address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_address_id: + type: string + description: The ID of the shipping address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + 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. + $ref: '#/components/schemas/currency' + tax_rate: + description: The order's tax rate + type: number + example: 0 + discounts: + type: array + description: >- + The discounts used in the order. Available if the relation + `discounts` is expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: >- + The gift cards used in the order. Available if the relation + `gift_cards` is expanded. + items: + type: object + description: A gift card object. + shipping_methods: + type: array + description: >- + The shipping methods used in the order. Available if the relation + `shipping_methods` is expanded. + items: + $ref: '#/components/schemas/shipping_method' + payments: + type: array + description: >- + The payments used in the order. Available if the relation `payments` + is expanded. + items: + $ref: '#/components/schemas/payment' + fulfillments: + type: array + description: >- + The fulfillments used in the order. Available if the relation + `fulfillments` is expanded. + items: + $ref: '#/components/schemas/fulfillment' + returns: + type: array + description: >- + The returns associated with the order. Available if the relation + `returns` is expanded. + items: + type: object + description: A return object. + claims: + type: array + description: >- + The claims associated with the order. Available if the relation + `claims` is expanded. + items: + type: object + description: A claim order object. + refunds: + type: array + description: >- + The refunds associated with the order. Available if the relation + `refunds` is expanded. + items: + type: object + description: A refund object. + swaps: + type: array + description: >- + The swaps associated with the order. Available if the relation + `swaps` is expanded. + items: + type: object + description: A swap object. + draft_order_id: + type: string + description: The ID of the draft order this order is associated with. + example: null + draft_order: + description: >- + A draft order object. Available if the relation `draft_order` is + expanded. + type: object + items: + type: array + description: >- + The line items that belong to the order. Available if the relation + `items` is expanded. + items: + $ref: '#/components/schemas/line_item' + gift_card_transactions: + type: array + description: >- + The gift card transactions used in the order. Available if the + relation `gift_card_transactions` is expanded. + items: + $ref: '#/components/schemas/gift_card_transaction' + canceled_at: + type: string + description: The date the order was canceled on. + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the processing of the order + in case of failure. + 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. + type: string + example: null + sales_channel_id: + type: string + description: The ID of the sales channel this order is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: The total amount refunded if the order is returned. + example: 0 + total: + type: integer + description: The total amount of the order + example: 8200 + subtotal: + type: integer + description: The subtotal of the order + example: 8000 + paid_total: + type: integer + description: The total amount paid + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 + payment_provider: + title: Payment Provider + description: Represents a Payment Provider plugin and holds its installation status. + x-resourceId: payment_provider + required: + - id + 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 + payment_session: + 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. + x-resourceId: payment_session + required: + - cart_id + - provider_id + - status + properties: + id: + type: string + description: The payment session's ID + example: ps_01G901XNSRM2YS3ASN9H5KG3FZ + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + 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. + type: boolean + 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: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + payment: + title: Payment + description: >- + Payments represent an amount authorized with a given payment method, + Payments can be captured, canceled or refunded. + x-resourceId: payment + required: + - amount + - currency_code + - provider_id + properties: + id: + type: string + description: The payment's ID + example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE + swap_id: + description: The ID of the Swap that the Payment is used for. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Payment is used for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + 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. + $ref: '#/components/schemas/currency' + amount_refunded: + description: >- + The amount of the original Payment amount that has been refunded + back to the Customer. + type: integer + 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. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Payment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a payment + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + price_list: + title: Price List + description: >- + Price Lists represents a set of prices that overrides the default price + for one or more product variants. + x-resourceId: price_list + required: + - name + - description + properties: + id: + type: string + description: The price list's ID + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + name: + type: string + description: The price list's name + example: VIP Prices + description: + type: string + description: The price list's description + 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. + type: string + format: date-time + ends_at: + description: The date with timezone that the Price List stops being valid. + 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: + type: object + description: A customer group object. + 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/money_amount' + 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 + product_collection: + title: Product Collection + description: Product Collections represents a group of Products that are related. + x-resourceId: product_collection + required: + - title + properties: + id: + type: string + description: The product collection's ID + 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. + type: string + example: summer-collection + products: + description: >- + The Products contained in the Product Collection. Available if the + relation `products` is expanded. + type: array + items: + type: object + description: A product collection object. + 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 + product_option_value: + 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. + x-resourceId: product_option_value + required: + - value + - option_id + - variant_id + properties: + id: + type: string + description: The product option value's ID + 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. + $ref: '#/components/schemas/product_option' + 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. + $ref: '#/components/schemas/product_variant' + 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 + product_option: + 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. + x-resourceId: product_option + required: + - title + - product_id + properties: + id: + type: string + description: The product option's ID + 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/product_option_value' + 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. + type: object + 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 + product_tag: + title: Product Tag + description: Product Tags can be added to Products for easy filtering and grouping. + x-resourceId: product_tag + required: + - value + properties: + id: + type: string + description: The product tag's ID + example: ptag_01G8K2MTMG9168F2B70S1TAVK3 + value: + description: The value that the Product Tag represents + type: string + example: Pants + 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 + product_tax_rate: + title: Product Tax Rate + description: >- + Associates a tax rate with a product to indicate that the product is + taxed in a certain way + x-resourceId: product_tax_rate + required: + - product_id + - rate_id + properties: + product_id: + description: The ID of the Product + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: Available if the relation `product` is expanded. + $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. + $ref: '#/components/schemas/tax_rate' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + product_type_tax_rate: + 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 + x-resourceId: product_type_tax_rate + required: + - product_type_id + - rate_id + 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. + $ref: '#/components/schemas/product_type' + 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. + $ref: '#/components/schemas/tax_rate' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + product_type: + title: Product Type + description: >- + Product Type can be added to Products for filtering and reporting + purposes. + x-resourceId: product_type + required: + - value + properties: + id: + type: string + description: The product type's ID + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + value: + description: The value that the Product Type represents. + type: string + example: Clothing + 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 + product_variant: + 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. + x-resourceId: product_variant + required: + - title + - product_id + - inventory_quantity + properties: + id: + type: string + description: The product variant's ID + 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. + type: object + 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/money_amount' + 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. + type: string + example: shirt-123 + barcode: + description: >- + A generic field for a GTIN number that can be used to identify the + Product Variant. + type: string + example: null + ean: + description: >- + An EAN barcode number that can be used to identify the Product + Variant. + type: string + example: null + upc: + description: >- + A UPC barcode number that can be used to identify the Product + Variant. + type: string + example: null + variant_rank: + description: The ranking of this variant + 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. + 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. + 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. + 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. + type: string + example: null + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + 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/product_option_value' + 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 + 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. + x-resourceId: product + required: + - title + - profile_id + properties: + id: + type: string + description: The product's ID + 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. + type: string + description: + description: A short description of the Product. + type: string + example: Every programmer's best friend. + handle: + description: A unique identifier for the Product (e.g. for slug structure). + 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. + 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/product_option' + 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/product_variant' + 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. + $ref: '#/components/schemas/shipping_profile' + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + 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. + 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. + 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. + 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. + type: string + example: null + collection_id: + type: string + description: The Product Collection that the Product belongs to + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + collection: + description: >- + A product collection object. Available if the relation `collection` + is expanded. + type: object + type_id: + type: string + description: The Product type that the Product belongs to + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: Available if the relation `type` is expanded. + $ref: '#/components/schemas/product_type' + tags: + description: >- + The Product Tags assigned to the Product. Available if the relation + `tags` is expanded. + type: array + items: + $ref: '#/components/schemas/product_tag' + 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 + 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: + type: object + description: A sales channel object. + 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 + 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. + x-resourceId: refund + required: + - order_id + - amount + properties: + id: + type: string + description: The refund's ID + example: ref_01G1G5V27GYX4QXNARRQCW1N8T + order_id: + description: The id of the Order that the Refund is related to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + 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. + 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: + type: string + description: >- + Randomly generated key used to continue the completion of the refund + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + 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. + x-resourceId: region + required: + - name + - currency_code + - tax_rate + properties: + id: + type: string + description: The cart's ID + 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. + $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/tax_rate' + tax_code: + description: >- + The tax code used on purchases in the Region. This may be used by + other systems for accounting purposes. + 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: + type: string + description: The ID of the tax provider used in this region + example: null + tax_provider: + description: Available if the relation `tax_provider` is expanded. + $ref: '#/components/schemas/tax_provider' + 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/payment_provider' + fulfillment_providers: + description: >- + The Fulfillment Providers that can be used to fulfill orders in the + Region. Available if the relation `payment_providers` is expanded. + type: array + items: + $ref: '#/components/schemas/fulfillment_provider' + 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 + return_item: + title: Return Item + description: >- + Correlates a Line Item with a Return, keeping track of the quantity of + the Line Item that will be returned. + x-resourceId: return_item + required: + - return_id + - item_id + properties: + return_id: + description: The id of the Return that the Return Item belongs to. + type: string + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + return_order: + description: Available if the relation `return_order` is expanded. + $ref: '#/components/schemas/return' + item_id: + description: The id of the Line Item that the Return Item references. + type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + 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. + type: integer + example: 1 + recieved_quantity: + description: The quantity that was received in the warehouse. + type: integer + example: 1 + reason_id: + description: The ID of the reason for returning the item. + type: string + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + reason: + description: Available if the relation `reason` is expanded. + $ref: '#/components/schemas/return_reason' + note: + description: An optional note with additional details about the Return. + type: string + example: I didn't like it. + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + return_reason: + 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. + x-resourceId: return_reason + required: + - value + - label + properties: + id: + type: string + description: The cart's ID + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + description: + description: A description of the Reason. + type: string + example: Items that are damaged + label: + description: A text that can be displayed to the Customer as a reason. + type: string + example: Damaged goods + value: + description: The value to identify the reason by. + type: string + example: damaged + parent_return_reason_id: + type: string + description: The ID of the parent reason. + example: null + parent_return_reason: + description: Available if the relation `parent_return_reason` is expanded. + $ref: '#/components/schemas/return_reason' + return_reason_children: + description: Available if the relation `return_reason_children` is expanded. + $ref: '#/components/schemas/return_reason' + 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 + 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. + x-resourceId: return + required: + - refund_amount + properties: + id: + type: string + description: The return's ID + 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/return_item' + swap_id: + description: The ID of the Swap that the Return is a part of. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The ID of the Order that the Return is made from. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + claim_order_id: + description: The ID of the Claim that the Return is a part of. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + 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. + type: array + items: + $ref: '#/components/schemas/shipping_method' + shipping_data: + description: >- + Data about the return shipment as provided by the Fulfilment + Provider that handles the return shipment. + type: object + example: {} + 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. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the return + in case of failure. + 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. + type: string + format: date-time + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + sales_channel: + title: Sales Channel + description: A Sales Channel + x-resourceId: sales_channel + required: + - name + properties: + id: + type: string + description: The sales channel's ID + example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A + name: + description: The name of the sales channel. + type: string + example: Market + description: + description: The description of the sales channel. + type: string + example: Multi-vendor market + is_disabled: + description: Specify if the sales channel is enabled or disabled. + type: boolean + default: false + 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 + shipping_method_tax_line: + title: Shipping Method Tax Line + description: Shipping Method Tax Line + x-resourceId: shipping_method_tax_line + required: + - shipping_method_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + shipping_method_id: + type: string + description: The ID of the line item + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_method: + description: Available if the relation `shipping_method` is expanded. + $ref: '#/components/schemas/shipping_method' + code: + description: A code to identify the tax type by + 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: + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + shipping_method: + 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. + x-resourceId: shipping_method + required: + - shipping_option_id + - price + properties: + id: + type: string + description: The shipping method's ID + 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 + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' + order_id: + description: The id of the Order that the Shipping Method is used on. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + return_id: + description: The id of the Return that the Shipping Method is used on. + type: string + example: null + return_order: + description: >- + A return object. Available if the relation `return_order` is + expanded. + type: object + swap_id: + description: The id of the Swap that the Shipping Method is used on. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Shipping Method is used on. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Shipping Method is used on. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + type: array + description: Available if the relation `tax_lines` is expanded. + items: + $ref: '#/components/schemas/shipping_method_tax_line' + 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: {} + shipping_option_requirement: + title: Shipping Option Requirement + description: >- + A requirement that a Cart must satisfy for the Shipping Option to be + available to the Cart. + x-resourceId: shipping_option_requirement + required: + - shipping_option_id + - type + - amount + properties: + id: + type: string + description: The shipping option requirement's ID + 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. + $ref: '#/components/schemas/shipping_option' + 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: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + shipping_option: + 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. + x-resourceId: shipping_option + required: + - name + - region_id + - profile_id + - provider_id + - price_type + properties: + id: + type: string + description: The shipping option's ID + 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: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + 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. + $ref: '#/components/schemas/shipping_profile' + 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. + $ref: '#/components/schemas/fulfillment_provider' + 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`. + type: integer + example: 200 + is_return: + description: >- + Flag to indicate if the Shipping Option can be used for Return + shipments. + 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/shipping_option_requirement' + data: + description: >- + The data needed for the Fulfillment Provider to identify the + Shipping Option. + type: object + example: {} + 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 + shipping_profile: + title: Shipping Profile + description: >- + Shipping Profiles have a set of defined Shipping Options that can be + used to fulfill a given set of Products. + x-resourceId: shipping_profile + required: + - name + - type + properties: + id: + type: string + description: The shipping profile's ID + 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: + type: object + description: A product object. + 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/shipping_option' + 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 + shipping_tax_rate: + 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 + x-resourceId: shipping_tax_rate + required: + - shipping_option_id + - rate_id + 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. + $ref: '#/components/schemas/shipping_option' + 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. + $ref: '#/components/schemas/tax_rate' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + staged_job: + title: Staged Job + description: A staged job resource + x-resourceId: staged_job + required: + - event_name + properties: + id: + type: string + description: The staged job's ID + 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: {} + store: + title: Store + description: 'Holds settings for the Store, such as name, currencies, etc.' + x-resourceId: store + properties: + id: + type: string + description: The store's ID + 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. + $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. + 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. + type: string + example: null + invite_link_template: + description: A template to generate Invite links from + type: string + example: null + default_sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + default_sales_channel: + description: >- + A sales channel object. Available if the relation + `default_sales_channel` is expanded. + type: object + metadata: + type: object + description: An optional key-value map with additional details + 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. + x-resourceId: swap + required: + - fulfillment_status + - payment_status + - order_id + properties: + id: + type: string + description: The swap's ID + example: swap_01F0YET86Y9G92D3YDR9Y6V676 + fulfillment_status: + description: The status of the Fulfillment of the Swap. + type: string + enum: + - not_fulfilled + - fulfilled + - 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. + type: object + 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/line_item' + 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. + type: object + 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. + $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. + 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. + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + shipping_methods: + description: >- + The Shipping Methods used to fulfill the addtional items purchased. + Available if the relation `shipping_methods` is expanded. + type: array + items: + $ref: '#/components/schemas/shipping_method' + cart_id: + description: The id of the Cart that the Customer will use to confirm the Swap. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + allow_backorder: + description: 'If true, swaps can be completed with items out of stock' + type: boolean + default: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the swap + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + confirmed_at: + description: >- + The date with timezone at which the Swap was confirmed by the + Customer. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Swap was canceled. + type: string + format: date-time + no_notification: + description: 'If set to true, no notification will be sent related to this swap' + type: boolean + example: false + 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 + tax_line: + title: Tax Line + description: Line item that specifies an amount of tax to add to a line item. + x-resourceId: tax_line + required: + - rate + - name + properties: + id: + type: string + description: The tax line's ID + example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + code: + description: A code to identify the tax type by + 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: + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + tax_provider: + title: Tax Provider + description: The tax service used to calculate taxes + x-resourceId: tax_provider + 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 + tax_rate: + title: Tax Rate + description: >- + A Tax Rate can be used to associate a certain rate to charge on products + within a given Region + x-resourceId: line_item + required: + - name + - region_id + properties: + id: + type: string + description: The tax rate's ID + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + rate: + description: The numeric rate to charge + type: number + example: 10 + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + region_id: + type: string + description: The id of the Region that the rate belongs to + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + products: + type: array + description: >- + The products that belong to this tax rate. Available if the relation + `products` is expanded. + items: + type: object + description: A product object. + product_types: + type: array + description: >- + The product types that belong to this tax rate. Available if the + relation `product_types` is expanded. + items: + type: object + description: A product type object. + shipping_options: + type: array + description: >- + The shipping options that belong to this tax rate. Available if the + relation `shipping_options` is expanded. + items: + type: object + description: A shipping option object. + product_count: + description: The count of products + type: integer + example: null + product_type_count: + description: The count of product types + type: integer + example: null + shipping_option_count: + description: The count of shipping options + type: integer + example: null + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + tracking_link: + 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. + x-resourceId: tracking_link + required: + - tracking_number + - fulfillment_id + properties: + id: + type: string + description: The tracking link's ID + example: tlink_01G8ZH853Y6TFXWPG5EYE81X63 + url: + description: The URL at which the status of the shipment can be tracked. + type: string + format: uri + tracking_number: + description: The tracking number given by the shipping carrier. + type: string + format: RH370168054CN + fulfillment_id: + type: string + description: The id of the Fulfillment that the Tracking Link references. + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + fulfillment: + description: Available if the relation `fulfillment` is expanded. + $ref: '#/components/schemas/fulfillment' + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a process + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + user: + title: User + description: Represents a User who can manage store settings. + x-resourceId: user + required: + - email + properties: + id: + type: string + description: The user's ID + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + email: + description: The email of the User + type: string + format: email + first_name: + description: The first name of the User + type: string + example: Levi + last_name: + description: The last name of the User + type: string + example: Bogan + api_token: + description: An API token associated with the user. + type: string + example: null + 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 + multiple_errors: + title: Multiple Errors + x-resourceId: multiple_errors + 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 + x-resourceId: error + 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. diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index 3f61b9f917..f9a5e5d76a 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -2,9 +2,19 @@ openapi: 3.0.0 info: version: 1.0.0 title: Medusa Admin API - description: >- + 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. + + + license: name: MIT url: 'https://github.com/medusajs/medusa/blob/master/LICENSE' @@ -66,7 +76,7 @@ tags: - name: Product Tag description: Product Tag endpoints that allow handling product tags in Medusa. x-resourceId: product_tag - - name: Product Types + - name: Product Type description: Product Types endpoints that allow handling product types in Medusa. x-resourceId: product_type - name: Product Variant @@ -133,6 +143,25 @@ paths: code: type: string description: The code for the generated token. + 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: @@ -144,12 +173,33 @@ paths: properties: apps: $ref: '#/components/schemas/OAuth' + '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-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: @@ -163,6 +213,18 @@ paths: type: array items: $ref: '#/components/schemas/OAuth' + '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 @@ -185,34 +247,30 @@ paths: password: type: string description: The User's password. - tags: - - Auth - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - user: - $ref: '#/components/schemas/user' - '401': - description: The user doesn't exist or the credentials are incorrect. - delete: - operationId: DeleteAuth - summary: Delete Session - x-authenticated: true - description: Deletes the current session for the logged in user. - tags: - - Auth - responses: - '200': - description: OK - get: - operationId: GetAuth - summary: Get Session - x-authenticated: true - description: Gets the currently logged in User. + 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: @@ -225,7 +283,113 @@ paths: user: $ref: '#/components/schemas/user' '400': - description: An error occurred. + $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: Delete Session + x-authenticated: true + description: Deletes the current session for the logged in user. + 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 Session + x-authenticated: true + description: Gets the currently logged in User. + 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: + properties: + user: + $ref: '#/components/schemas/user' + '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 @@ -239,6 +403,32 @@ paths: description: The ID of the batch job. 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.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: @@ -250,6 +440,18 @@ paths: properties: batch_job: $ref: '#/components/schemas/batch_job' + '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 @@ -263,6 +465,32 @@ paths: description: The ID of the batch job. 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.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: @@ -274,6 +502,18 @@ paths: properties: batch_job: $ref: '#/components/schemas/batch_job' + '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 @@ -319,6 +559,41 @@ paths: Set a batch job in dry_run mode to get some information on what will be done without applying any modifications. default: false + 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: @@ -330,6 +605,18 @@ paths: properties: batch_job: $ref: '#/components/schemas/batch_job' + '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 @@ -571,6 +858,32 @@ paths: type: string description: filter by dates greater than or equal to this date format: date + 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: @@ -593,6 +906,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -606,6 +931,32 @@ paths: description: The ID of the Batch Job 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.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: @@ -617,6 +968,18 @@ paths: properties: batch_job: $ref: '#/components/schemas/batch_job' + '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 @@ -643,6 +1006,25 @@ paths: items: description: The ID of a Product to add to the Product Collection. type: string + 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: @@ -654,6 +1036,18 @@ paths: properties: collection: $ref: '#/components/schemas/product_collection' + '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: Removes products associated with a Product Collection @@ -681,6 +1075,25 @@ paths: items: description: The ID of a Product to add to the Product Collection. type: string + 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: @@ -703,6 +1116,18 @@ paths: items: description: The ID of a Product to add to the Product Collection. type: string + '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 @@ -729,6 +1154,40 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -740,6 +1199,18 @@ paths: properties: collection: $ref: '#/components/schemas/product_collection' + '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 Product Collections @@ -839,6 +1310,32 @@ paths: type: string description: filter by dates greater than or equal to this date format: date + 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: @@ -861,6 +1358,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -874,6 +1383,32 @@ paths: description: The ID of the Collection. 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.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: @@ -894,6 +1429,18 @@ paths: type: boolean description: Whether the collection was deleted successfully or not. 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: GetCollectionsCollection summary: Retrieve a Product Collection @@ -906,6 +1453,32 @@ paths: description: The ID of the Product Collection 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.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: @@ -917,6 +1490,18 @@ paths: properties: collection: $ref: '#/components/schemas/product_collection' + '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 Product Collection @@ -947,6 +1532,40 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -958,6 +1577,18 @@ paths: properties: collection: $ref: '#/components/schemas/product_collection' + '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/batch': post: operationId: PostCustomerGroupsGroupCustomersBatch @@ -988,6 +1619,49 @@ paths: id: description: ID of the customer 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.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: @@ -999,6 +1673,18 @@ paths: properties: customer_group: $ref: '#/components/schemas/customer_group' + '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 a list of customers from a customer group ' @@ -1028,6 +1714,49 @@ paths: id: description: ID of the customer 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.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: @@ -1039,6 +1768,18 @@ paths: properties: customer_group: $ref: '#/components/schemas/customer_group' + '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 @@ -1046,6 +1787,40 @@ paths: description: Creates a CustomerGroup. x-authenticated: true parameters: [] + 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: @@ -1057,6 +1832,18 @@ paths: properties: customer_group: $ref: '#/components/schemas/customer_group' + '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' requestBody: content: application/json: @@ -1188,6 +1975,32 @@ paths: groups of the result. 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.customerGroups.list() + + .then(({ customer_groups, limit, offset, count }) => { + console.log(customer_groups.id); + }); + - 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: @@ -1210,6 +2023,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -1223,6 +2048,32 @@ paths: description: The ID of the Customer Group 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.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: @@ -1245,6 +2096,18 @@ paths: Whether the customer group was deleted successfully or not. 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: GetCustomerGroupsGroup summary: Retrieve a CustomerGroup @@ -1271,6 +2134,32 @@ paths: group. 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.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: @@ -1282,6 +2171,18 @@ paths: properties: customer_group: $ref: '#/components/schemas/customer_group' + '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 CustomerGroup @@ -1305,6 +2206,40 @@ paths: metadata: description: Metadata for the customer. type: object + 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: @@ -1316,6 +2251,18 @@ paths: properties: customer_group: $ref: '#/components/schemas/customer_group' + '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 @@ -1329,6 +2276,32 @@ paths: description: The ID of the customer group. 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.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: @@ -1351,6 +2324,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -1391,6 +2376,46 @@ paths: type: object tags: - Customer + 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: [] responses: '201': description: OK @@ -1400,6 +2425,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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 @@ -1428,6 +2465,32 @@ paths: description: 'a search term to search email, first_name, and last_name.' 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.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: @@ -1450,6 +2513,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -1473,6 +2548,32 @@ paths: description: (Comma separated) Which fields should be included in the customer. 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.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: @@ -1484,6 +2585,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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 @@ -1543,6 +2656,40 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -1554,6 +2701,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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 @@ -1573,6 +2732,32 @@ paths: description: The ID of the Region. 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.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: @@ -1584,6 +2769,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 availability @@ -1604,6 +2801,32 @@ paths: description: The ID of the Region. 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.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: @@ -1615,6 +2838,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -1691,6 +2926,42 @@ paths: customer groups. items: type: string + 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: @@ -1702,6 +2973,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -1861,6 +3144,54 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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 + }, + 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" + } + }' + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -1872,6 +3203,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -1935,6 +3278,32 @@ paths: description: Comma separated list of relations 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.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: @@ -1957,6 +3326,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -1972,6 +3353,41 @@ paths: description: The ID of the Discount to create the dynamic code from." 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.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: @@ -1983,6 +3399,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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' requestBody: content: application/json: @@ -2032,6 +3460,33 @@ paths: 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.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: @@ -2057,9 +3512,22 @@ paths: discount: description: The Discount to which the condition used to belong $ref: '#/components/schemas/discount' + '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: Gets a DiscountCondition + description: Gets a DiscountCondition x-authenticated: true parameters: - in: path @@ -2084,7 +3552,33 @@ paths: description: Comma separated list of fields to include in the results. schema: type: string - description: Gets a DiscountCondition + 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: @@ -2096,6 +3590,18 @@ paths: properties: discount_condition: $ref: '#/components/schemas/discount_condition' + '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 DiscountCondition @@ -2169,6 +3675,45 @@ paths: customer groups. items: 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.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: @@ -2180,6 +3725,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -2193,6 +3750,32 @@ paths: description: The ID of the Discount 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.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: @@ -2213,6 +3796,18 @@ paths: type: boolean description: Whether the discount was deleted successfully or not. 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: GetDiscountsDiscount summary: Retrieve a Discount @@ -2235,6 +3830,32 @@ paths: 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.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: @@ -2246,6 +3867,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -2393,6 +4026,40 @@ paths: metadata: description: An object containing metadata of the discount type: object + 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: @@ -2404,6 +4071,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -2423,6 +4102,32 @@ paths: description: The ID of the Discount 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.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: @@ -2434,6 +4139,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -2457,6 +4174,32 @@ paths: 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.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: @@ -2468,6 +4211,18 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + '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 @@ -2573,6 +4328,62 @@ paths: The optional key-value map with additional details about the Draft Order. type: object + 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: @@ -2584,6 +4395,18 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' + '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 @@ -2609,6 +4432,32 @@ paths: and display IDs of draft orders 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.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: @@ -2631,6 +4480,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -2671,6 +4532,40 @@ paths: The optional key-value map with additional details about the Line Item. type: object + 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: @@ -2682,6 +4577,18 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' + '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 @@ -2695,6 +4602,32 @@ paths: description: The ID of the Draft Order. 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.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: @@ -2715,6 +4648,18 @@ paths: type: boolean description: Whether the draft order was deleted successfully or not. 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: GetDraftOrdersDraftOrder summary: Retrieve a Draft Order @@ -2727,6 +4672,32 @@ paths: description: The ID of the Draft Order. 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.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: @@ -2738,6 +4709,18 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' + '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 @@ -2757,6 +4740,33 @@ paths: description: The ID of the Draft Order. 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.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: @@ -2768,6 +4778,18 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' + '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 for a Draft Order @@ -2805,6 +4827,41 @@ paths: The optional key-value map with additional details about the Line Item. type: object + 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: @@ -2816,6 +4873,18 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' + '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 for a Draft Order @@ -2829,6 +4898,32 @@ paths: description: The Draft Order id. 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.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: @@ -2840,6 +4935,18 @@ paths: properties: order: $ref: '#/components/schemas/draft-order' + '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 @@ -2897,6 +5004,40 @@ paths: customer_id: description: The ID of the Customer to associate the Draft Order with. 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.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: @@ -2908,6 +5049,18 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' + '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 @@ -2947,6 +5100,40 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -2958,6 +5145,18 @@ paths: properties: gift_card: $ref: '#/components/schemas/gift_card' + '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 @@ -2981,6 +5180,32 @@ paths: description: a search term to search by code or display ID 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.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: @@ -3003,6 +5228,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -3016,6 +5253,32 @@ paths: description: The ID of the Gift Card 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.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: @@ -3036,6 +5299,18 @@ paths: type: boolean description: Whether the gift card was deleted successfully or not. 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: GetGiftCardsGiftCard summary: Retrieve a Gift Card @@ -3048,6 +5323,32 @@ paths: description: The ID of the Gift Card. 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.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: @@ -3059,6 +5360,18 @@ paths: properties: gift_card: $ref: '#/components/schemas/gift_card' + '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 @@ -3102,6 +5415,40 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -3113,6 +5460,18 @@ paths: properties: gift_card: $ref: '#/components/schemas/gift_card' + '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 @@ -3147,11 +5506,71 @@ paths: description: The desired password for the User type: string format: password + 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 @@ -3177,16 +5596,94 @@ paths: - admin - member - developer + 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 all Invites description: Lists all Invites x-authenticated: true + 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: @@ -3200,6 +5697,18 @@ paths: type: array items: $ref: '#/components/schemas/invite' + '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 @@ -3213,6 +5722,32 @@ paths: description: The ID of the Invite 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.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: @@ -3233,6 +5768,18 @@ paths: type: boolean description: Whether or not the Invite 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' '/invites/{invite_id}/resend': post: operationId: PostInvitesInviteResend @@ -3246,11 +5793,53 @@ paths: description: The ID of the Invite 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.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 @@ -3275,6 +5864,44 @@ paths: value: type: string description: The content of the Note to 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: @@ -3286,6 +5913,18 @@ paths: properties: note: $ref: '#/components/schemas/note' + '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 @@ -3309,6 +5948,30 @@ paths: description: The ID which the notes belongs to 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.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: @@ -3331,6 +5994,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -3344,6 +6019,32 @@ paths: description: The ID of the Note 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.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: @@ -3364,6 +6065,18 @@ paths: type: boolean description: Whether or not the Note 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: GetNotesNote summary: Get Note @@ -3376,6 +6089,32 @@ paths: description: The ID of the note 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.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: @@ -3387,6 +6126,18 @@ paths: properties: note: $ref: '#/components/schemas/note' + '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: Updates a Note @@ -3409,6 +6160,40 @@ paths: value: type: string description: The updated description of the Note. + 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: @@ -3420,6 +6205,18 @@ paths: properties: note: $ref: '#/components/schemas/note' + '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 @@ -3481,6 +6278,32 @@ paths: notifications or not 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.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: @@ -3494,6 +6317,18 @@ paths: type: array items: $ref: '#/components/schemas/notification' + '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 @@ -3519,6 +6354,32 @@ paths: A new address or user identifier that the Notification should be sent to 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.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: @@ -3530,6 +6391,18 @@ paths: properties: notification: $ref: '#/components/schemas/notification' + '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}/shipping-methods': post: operationId: PostOrdersOrderShippingMethods @@ -3546,6 +6419,42 @@ paths: description: The ID of the Order. 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.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: @@ -3557,6 +6466,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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' requestBody: content: application/json: @@ -3595,6 +6516,32 @@ paths: description: The ID of the Order. 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.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: @@ -3606,6 +6553,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3625,6 +6584,33 @@ paths: description: The ID of the Claim. 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.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: @@ -3636,6 +6622,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3661,6 +6659,34 @@ paths: description: The ID of the Fulfillment. 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.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: @@ -3672,6 +6698,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3697,6 +6735,34 @@ paths: description: The ID of the Fulfillment. 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.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: @@ -3708,6 +6774,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3727,6 +6805,33 @@ paths: description: The ID of the Fulfillment 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.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: @@ -3738,6 +6843,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3754,6 +6871,32 @@ paths: description: The ID of the Order. 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.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: @@ -3765,6 +6908,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3784,6 +6939,33 @@ paths: description: The ID of the Swap. 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.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: @@ -3795,6 +6977,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3808,6 +7002,32 @@ paths: description: The ID of the Order. 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.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: @@ -3819,6 +7039,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3832,6 +7064,32 @@ paths: description: The ID of the Order. 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.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: @@ -3843,6 +7101,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -3877,6 +7147,41 @@ paths: type: array items: 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.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: @@ -3888,6 +7193,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4024,6 +7341,52 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -4035,6 +7398,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4081,6 +7456,50 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -4092,6 +7511,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4125,6 +7556,40 @@ paths: If set to true no notification will be send related to this Shipment. type: boolean + 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: @@ -4136,6 +7601,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4175,6 +7652,41 @@ paths: If set to true no notification will be send related to this Claim. type: boolean + 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: @@ -4186,6 +7698,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4283,6 +7807,50 @@ paths: description: 'If true, swaps can be completed with items out of stock' type: boolean default: true + 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: @@ -4294,6 +7862,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4328,6 +7908,33 @@ paths: If set to true no notification will be send related to this Claim. type: boolean + 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: @@ -4339,6 +7946,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4373,6 +7992,33 @@ paths: If set to true no notification will be send related to this Claim. type: boolean + 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: @@ -4384,6 +8030,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4397,6 +8055,32 @@ paths: description: The ID of the Order. 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.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: @@ -4408,6 +8092,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4488,6 +8184,40 @@ paths: A flag to indicate if no notifications should be emitted related to the updated order. type: boolean + 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: @@ -4499,6 +8229,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4719,6 +8461,32 @@ paths: the result. 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.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: @@ -4741,6 +8509,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -4763,6 +8543,33 @@ paths: description: The ID of the Swap. 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.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: @@ -4774,6 +8581,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4809,6 +8628,42 @@ paths: If set to true no notification will be send related to this Refund. type: boolean + 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: @@ -4820,6 +8675,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -4893,6 +8760,50 @@ paths: refund: description: The amount to refund. type: integer + 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 @@ -4905,6 +8816,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -5017,6 +8940,40 @@ paths: An optional set of key-value pairs to hold additional information. type: object + 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: @@ -5028,6 +8985,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -5088,6 +9057,52 @@ paths: If true the prices will replace all existing prices associated with the Price List. type: boolean + 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: @@ -5099,6 +9114,18 @@ paths: properties: price_list: $ref: '#/components/schemas/price_list' + '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: Batch delete prices that belong to a Price List @@ -5123,6 +9150,44 @@ paths: type: array items: 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.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: @@ -5145,6 +9210,18 @@ paths: type: boolean description: Whether or not the items were 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' /price-lists: post: operationId: PostPriceListsPriceList @@ -5233,6 +9310,60 @@ paths: id: description: The ID of a customer group type: string + 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: @@ -5244,6 +9375,18 @@ paths: properties: price_list: $ref: '#/components/schemas/price_list' + '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 @@ -5390,6 +9533,32 @@ paths: type: string description: filter by dates greater than or equal to this date format: date + 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: @@ -5412,6 +9581,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -5425,6 +9606,32 @@ paths: description: The ID of the Price List 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.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: @@ -5445,6 +9652,18 @@ paths: type: boolean description: Whether or not the items were 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: GetPriceListsPriceList summary: Retrieve a Price List @@ -5457,6 +9676,32 @@ paths: description: The ID of the Price List. 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.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: @@ -5468,6 +9713,18 @@ paths: properties: price_list: $ref: '#/components/schemas/price_list' + '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 @@ -5560,6 +9817,40 @@ paths: id: description: The ID of a customer group 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.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: @@ -5571,6 +9862,18 @@ paths: properties: price_list: $ref: '#/components/schemas/price_list' + '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 @@ -5592,6 +9895,34 @@ paths: description: The ID of the product from which the money amount will be deleted. 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.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: @@ -5614,6 +9945,18 @@ paths: type: boolean description: Whether or not the items were 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' '/price-lists/{id}/variants/{variant_id}/prices': delete: operationId: DeletePriceListsPriceListVariantsVariantPrices @@ -5635,6 +9978,34 @@ paths: description: The ID of the variant from which the money amount will be deleted. 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.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: @@ -5657,6 +10028,18 @@ paths: type: boolean description: Whether or not the items were 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' '/price-lists/{id}/products': get: operationId: GetPriceListsPriceListProducts @@ -5836,6 +10219,32 @@ paths: the result. 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.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: - Product responses: @@ -5858,6 +10267,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -5949,6 +10370,32 @@ paths: type: string description: filter by dates greater than or equal to this date format: date + 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: @@ -5969,6 +10416,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -6060,6 +10519,32 @@ paths: type: string description: filter by dates greater than or equal to this date format: date + 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: @@ -6080,6 +10565,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -6105,6 +10602,40 @@ paths: The title the Product Option will be identified by i.e. "Size" 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.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: @@ -6116,6 +10647,18 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 @@ -6363,6 +10906,42 @@ paths: An optional set of key-value pairs with additional information. type: object + 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: @@ -6374,6 +10953,18 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 Product @@ -6567,6 +11158,32 @@ paths: the result. 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.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: @@ -6589,6 +11206,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -6718,6 +11347,65 @@ paths: value: description: The value to give for the Product Option. 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.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: @@ -6729,6 +11417,18 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 Product Variants @@ -6763,6 +11463,17 @@ paths: schema: type: integer default: 100 + 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: @@ -6785,6 +11496,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -6808,6 +11531,32 @@ paths: description: The ID of the Product Option. 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.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: @@ -6830,6 +11579,18 @@ paths: default: true product: $ref: '#/components/schemas/product' + '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. @@ -6858,6 +11619,40 @@ paths: title: description: The title of the Product Option 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.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: @@ -6869,6 +11664,18 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 @@ -6882,6 +11689,32 @@ paths: description: The ID of the Product. 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.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: @@ -6902,6 +11735,18 @@ paths: type: boolean description: Whether or not the items were 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: GetProductsProduct summary: Retrieve a Product @@ -6914,6 +11759,32 @@ paths: description: The ID of the Product. 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.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: @@ -6925,6 +11796,18 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 @@ -7159,6 +12042,41 @@ paths: An optional set of key-value pairs with additional information. type: object + 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: @@ -7170,6 +12088,18 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 @@ -7189,6 +12119,32 @@ paths: description: The ID of the Product Variant. 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.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: @@ -7211,6 +12167,18 @@ paths: default: true product: $ref: '#/components/schemas/product' + '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 @@ -7233,6 +12201,8 @@ paths: content: application/json: schema: + required: + - prices properties: title: description: The title to identify the Product Variant by. @@ -7338,6 +12308,59 @@ paths: value: description: The value to give for the Product Option. 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.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: @@ -7349,12 +12372,50 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 Product Tags Usage Number description: Retrieves a list of Product Tags with how many times each is used. x-authenticated: true + 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: @@ -7377,12 +12438,50 @@ paths: value: description: The value of the tag. type: string + '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: operationId: GetProductsTypes summary: List Product Types description: Retrieves a list of Product Types. x-authenticated: true + 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: @@ -7396,6 +12495,18 @@ paths: type: array items: $ref: '#/components/schemas/product_type' + '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 @@ -7423,6 +12534,43 @@ paths: value: description: The metadata value 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.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: @@ -7434,6 +12582,18 @@ paths: properties: product: $ref: '#/components/schemas/product' + '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 @@ -7461,6 +12621,40 @@ paths: url: >- https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements description: See a list of codes. + 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: @@ -7472,6 +12666,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7495,6 +12701,40 @@ paths: provider_id: description: The ID of the Fulfillment Provider to add. 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.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: @@ -7506,6 +12746,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7529,6 +12781,40 @@ paths: provider_id: description: The ID of the Payment Provider to add. 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.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: @@ -7540,6 +12826,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7596,6 +12894,62 @@ paths: type: array items: 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.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: @@ -7607,6 +12961,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7651,6 +13017,32 @@ paths: description: >- Date comparison for when resulting region was deleted, i.e. less than, greater than etc. + 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: @@ -7673,6 +13065,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -7686,6 +13090,32 @@ paths: description: The ID of the Region. 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.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: @@ -7706,6 +13136,18 @@ paths: type: boolean description: Whether or not the items were 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: GetRegionsRegion summary: Retrieve a Region @@ -7718,6 +13160,32 @@ paths: description: The ID of the Region. 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.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: @@ -7729,6 +13197,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7798,6 +13278,40 @@ paths: type: array items: 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.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: @@ -7809,6 +13323,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7822,6 +13348,32 @@ paths: description: The ID of the Region. 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.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: @@ -7845,6 +13397,18 @@ paths: - id: manual-fulfillment - id: manual-fulfillment-return is_return: 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' '/regions/{id}/countries/{country_code}': delete: operationId: PostRegionsRegionCountriesCountry @@ -7867,6 +13431,32 @@ paths: externalDocs: url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' description: See a list of codes. + 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: @@ -7878,6 +13468,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7897,6 +13499,33 @@ paths: description: The ID of the Fulfillment Provider. 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.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: @@ -7908,6 +13537,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7927,6 +13568,33 @@ paths: description: The ID of the Payment Provider. 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.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: @@ -7938,6 +13606,18 @@ paths: properties: region: $ref: '#/components/schemas/region' + '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 @@ -7971,6 +13651,42 @@ paths: An optional set of key-value pairs with additional information. type: object + 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: @@ -7982,11 +13698,49 @@ paths: properties: return_reason: $ref: '#/components/schemas/return_reason' + '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-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: @@ -8000,6 +13754,18 @@ paths: type: array items: $ref: '#/components/schemas/return_reason' + '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 @@ -8013,6 +13779,32 @@ paths: description: The ID of the return reason 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.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: @@ -8033,6 +13825,18 @@ paths: type: boolean description: Whether or not the items were 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: GetReturnReasonsReason summary: Retrieve a Return Reason @@ -8045,6 +13849,32 @@ paths: description: The ID of the Return Reason. 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.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: @@ -8056,6 +13886,18 @@ paths: properties: return_reason: $ref: '#/components/schemas/return_reason' + '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 @@ -8089,6 +13931,40 @@ paths: An optional set of key-value pairs with additional information. type: object + 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: @@ -8100,6 +13976,18 @@ paths: properties: return_reason: $ref: '#/components/schemas/return_reason' + '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 @@ -8112,6 +14000,32 @@ paths: description: The ID of the Return. 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.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: @@ -8123,6 +14037,18 @@ paths: properties: order: $ref: '#/components/schemas/order' + '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 @@ -8141,6 +14067,32 @@ paths: schema: type: number default: '0' + 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: @@ -8163,6 +14115,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -8201,6 +14165,50 @@ paths: refund: description: The amount to refund. type: number + 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(({ return }) => { + console.log(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: @@ -8212,6 +14220,18 @@ paths: properties: return: $ref: '#/components/schemas/return' + '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 @@ -8243,6 +14263,48 @@ paths: id: type: string description: The ID of the product + 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: @@ -8254,6 +14316,18 @@ paths: properties: sales_channel: $ref: '#/components/schemas/sales_channel' + '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: Remove a list of products from a sales channel @@ -8284,6 +14358,48 @@ paths: id: description: The ID of a product 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.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: @@ -8295,6 +14411,18 @@ paths: properties: sales_channel: $ref: '#/components/schemas/sales_channel' + '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 @@ -8317,6 +14445,41 @@ paths: is_disabled: description: Whether the Sales Channel is disabled or not. type: boolean + 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: @@ -8328,6 +14491,18 @@ paths: properties: sales_channel: $ref: '#/components/schemas/sales_channel' + '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 @@ -8451,6 +14626,32 @@ paths: channel of the result. 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.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: @@ -8473,6 +14674,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -8486,6 +14699,32 @@ paths: description: The ID of the Sales channel. 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.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: @@ -8506,6 +14745,18 @@ paths: type: boolean description: Whether or not the items were 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: GetSalesChannelsSalesChannel summary: Retrieve a sales channel @@ -8518,6 +14769,32 @@ paths: description: The ID of the Sales channel. 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.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: @@ -8529,6 +14806,18 @@ paths: properties: sales_channel: $ref: '#/components/schemas/sales_channel' + '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 @@ -8555,6 +14844,40 @@ paths: is_disabled: type: boolean description: Indication of if the sales channel is active. + 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: @@ -8566,6 +14889,18 @@ paths: properties: sales_channel: $ref: '#/components/schemas/sales_channel' + '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 @@ -8647,6 +14982,49 @@ paths: An optional set of key-value pairs with additional information. type: object + 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: @@ -8658,6 +15036,18 @@ paths: properties: shipping_option: $ref: '#/components/schemas/shipping_option' + '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 @@ -8679,6 +15069,32 @@ paths: schema: type: boolean description: Flag for fetching admin specific options + 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: @@ -8695,6 +15111,18 @@ paths: count: type: integer description: The total number of items available + '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 @@ -8708,6 +15136,32 @@ paths: description: The ID of the Shipping Option. 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.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: @@ -8728,6 +15182,18 @@ paths: type: boolean description: Whether or not the items were 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: GetShippingOptionsOption summary: Retrieve a Shipping Option @@ -8740,6 +15206,32 @@ paths: description: The ID of the Shipping Option. 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.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: @@ -8751,6 +15243,18 @@ paths: properties: shipping_option: $ref: '#/components/schemas/shipping_option' + '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 @@ -8806,6 +15310,52 @@ paths: amount: description: The amount to compare with. type: integer + 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: @@ -8817,6 +15367,18 @@ paths: properties: shipping_option: $ref: '#/components/schemas/shipping_option' + '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 @@ -8833,6 +15395,40 @@ paths: name: description: The name of the Shipping Profile 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.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: @@ -8844,11 +15440,49 @@ paths: properties: shipping_profile: $ref: '#/components/schemas/shipping_profile' + '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-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: @@ -8862,6 +15496,18 @@ paths: type: array items: $ref: '#/components/schemas/shipping_profile' + '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 @@ -8875,6 +15521,32 @@ paths: description: The ID of the Shipping Profile. 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.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: @@ -8895,6 +15567,18 @@ paths: type: boolean description: Whether or not the items were 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: GetShippingProfilesProfile summary: Retrieve a Shipping Profile @@ -8907,6 +15591,32 @@ paths: description: The ID of the Shipping Profile. 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.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: @@ -8918,6 +15628,18 @@ paths: properties: shipping_profile: $ref: '#/components/schemas/shipping_profile' + '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 Profiles @@ -8937,6 +15659,40 @@ paths: name: description: The name of the Shipping Profile 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.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: @@ -8948,6 +15704,18 @@ paths: properties: shipping_profile: $ref: '#/components/schemas/shipping_profile' + '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 @@ -8964,6 +15732,32 @@ paths: externalDocs: url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' description: See a list of codes. + 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: @@ -8975,6 +15769,18 @@ paths: properties: store: $ref: '#/components/schemas/store' + '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: Remove a Currency Code @@ -8990,6 +15796,32 @@ paths: externalDocs: url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' description: See a list of codes. + 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: @@ -9001,12 +15833,48 @@ paths: properties: store: $ref: '#/components/schemas/store' + '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: Retrieve Store details. description: Retrieves the Store details x-authenticated: true + 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: @@ -9018,6 +15886,18 @@ paths: properties: store: $ref: '#/components/schemas/store' + '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. @@ -9062,6 +15942,40 @@ paths: An optional set of key-value pairs with additional information. type: object + 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: @@ -9073,12 +15987,50 @@ paths: properties: store: $ref: '#/components/schemas/store' + '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: Retrieve configured Payment Providers description: Retrieves the configured Payment Providers x-authenticated: true + 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: @@ -9092,12 +16044,50 @@ paths: type: array items: $ref: '#/components/schemas/payment_provider' + '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: Retrieve configured Tax Providers description: Retrieves the configured Tax Providers x-authenticated: true + 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: @@ -9111,6 +16101,18 @@ paths: type: array items: $ref: '#/components/schemas/tax_provider' + '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 @@ -9124,6 +16126,32 @@ paths: description: The ID of the Swap. 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.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: @@ -9135,6 +16163,18 @@ paths: properties: swap: $ref: '#/components/schemas/swap' + '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 @@ -9154,6 +16194,30 @@ paths: type: number default: '0' x-authenticated: true + 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: @@ -9176,6 +16240,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -9221,6 +16297,44 @@ paths: rate items: 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.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: @@ -9232,6 +16346,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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: Remove Tax Rate from Product Types @@ -9276,6 +16402,44 @@ paths: this tax rate items: 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.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: @@ -9287,6 +16451,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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 @@ -9330,6 +16506,44 @@ paths: description: The IDs of the products to associate with this tax rate items: 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.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: @@ -9341,6 +16555,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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: Removes Tax Rate from Products @@ -9385,6 +16611,44 @@ paths: rate items: 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.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: @@ -9396,6 +16660,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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 @@ -9441,6 +16717,45 @@ paths: rate items: 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.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: @@ -9452,6 +16767,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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: Removes a Tax Rate from Product Types @@ -9496,6 +16823,45 @@ paths: this tax rate items: 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.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: @@ -9507,6 +16873,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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 @@ -9572,6 +16950,44 @@ paths: rate items: 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.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: @@ -9583,6 +16999,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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 @@ -9662,6 +17090,32 @@ paths: type: array items: 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.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: @@ -9684,6 +17138,18 @@ paths: limit: type: integer description: The number of items per page + '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 @@ -9697,6 +17163,32 @@ paths: description: The ID of the Shipping Option. 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.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: @@ -9717,6 +17209,18 @@ paths: type: boolean description: Whether or not the items were 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: GetTaxRatesTaxRate summary: Get Tax Rate @@ -9747,6 +17251,32 @@ paths: items: type: string x-authenticated: true + 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: @@ -9758,6 +17288,18 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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 @@ -9824,6 +17366,40 @@ paths: rate items: 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.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: @@ -9835,14 +17411,24 @@ paths: properties: tax_rate: $ref: '#/components/schemas/tax_rate' + '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: Uploads a file description: Uploads a file to the specific fileservice that is installed in Medusa. x-authenticated: true - tags: - - Upload requestBody: content: multipart/form-data: @@ -9852,6 +17438,38 @@ paths: 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' \ + + --data-binary '{file_path}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Upload responses: '200': description: OK @@ -9868,6 +17486,18 @@ paths: type: string description: The URL of the uploaded file. format: uri + '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 @@ -9903,6 +17533,42 @@ paths: description: The Users password. type: string format: password + 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: @@ -9914,11 +17580,47 @@ paths: properties: user: $ref: '#/components/schemas/user' + '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: Retrieve all users description: Retrieves all users. x-authenticated: true + 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: @@ -9932,6 +17634,18 @@ paths: type: array items: $ref: '#/components/schemas/user' + '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 @@ -9945,6 +17659,32 @@ paths: description: The ID of the User. 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.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: - Users responses: @@ -9965,6 +17705,18 @@ paths: type: boolean description: Whether or not the items were 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: GetUsersUser summary: Retrieve a User @@ -9977,6 +17729,32 @@ paths: description: The ID of the User. 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.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: @@ -9988,6 +17766,18 @@ paths: properties: user: $ref: '#/components/schemas/user' + '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 @@ -10026,6 +17816,40 @@ paths: An optional set of key-value pairs with additional information. type: object + 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: @@ -10037,6 +17861,18 @@ paths: properties: user: $ref: '#/components/schemas/user' + '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 @@ -10054,11 +17890,61 @@ paths: description: The Users email. type: string format: email + 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 @@ -10084,6 +17970,42 @@ paths: description: The Users new password. type: string format: password + 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: @@ -10095,6 +18017,18 @@ paths: properties: user: $ref: '#/components/schemas/user' + '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 @@ -10119,6 +18053,32 @@ paths: 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.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: @@ -10141,7 +18101,291 @@ paths: limit: type: integer description: The number of items per page + '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/multiple_errors' + examples: + not_allowed: + $ref: '#/components/examples/not_allowed_error' + invalid_data: + $ref: '#/components/examples/invalid_data_error' + multiple_errors: + $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 -U + + UPDATE public.user SET api_token='' WHERE + email=''; + + ``` + + + Where: + + - `` is the name of the database schema you use for the Medusa + server. + + - `` is the name of the user that has privileges over the + database schema. + + - `` is the API token you want to associate with the user. + You can use [this tool to generate a random + token](https://randomkeygen.com/). + + - `` 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 alternatively following along with the JS Client request + samples, you must provide the `apiKey` option when creating the Medusa + client: + + + ```js + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3, + 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: address: title: Address @@ -15052,3 +23296,30 @@ components: description: An optional key-value map with additional details example: car: white + multiple_errors: + title: Multiple Errors + x-resourceId: multiple_errors + 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 + x-resourceId: error + 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. diff --git a/docs/api/admin/code_samples/JavaScript/admin_draft-orders_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/admin_draft-orders_{id}/postundefined new file mode 100644 index 0000000000..1afbe020cd --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/admin_draft-orders_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/auth/deleteundefined b/docs/api/admin/code_samples/JavaScript/auth/deleteundefined new file mode 100644 index 0000000000..5a92642a0a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/auth/deleteundefined @@ -0,0 +1,4 @@ +import Medusa from "@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() diff --git a/docs/api/admin/code_samples/JavaScript/auth/getundefined b/docs/api/admin/code_samples/JavaScript/auth/getundefined new file mode 100644 index 0000000000..961d7e2dc3 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/auth/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/auth/postundefined b/docs/api/admin/code_samples/JavaScript/auth/postundefined new file mode 100644 index 0000000000..bced0691ff --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/auth/postundefined @@ -0,0 +1,8 @@ +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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/batch-jobs/getundefined b/docs/api/admin/code_samples/JavaScript/batch-jobs/getundefined new file mode 100644 index 0000000000..92878e240b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/batch-jobs/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/batch-jobs/postundefined b/docs/api/admin/code_samples/JavaScript/batch-jobs/postundefined new file mode 100644 index 0000000000..83578011ea --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/batch-jobs/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}/getundefined new file mode 100644 index 0000000000..3fac0d4306 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}_cancel/postundefined new file mode 100644 index 0000000000..97186d0bde --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}_confirm/postundefined b/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}_confirm/postundefined new file mode 100644 index 0000000000..2a31a7350a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/batch-jobs_{id}_confirm/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/collections/getundefined b/docs/api/admin/code_samples/JavaScript/collections/getundefined new file mode 100644 index 0000000000..69ca746169 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/collections/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/collections/postundefined b/docs/api/admin/code_samples/JavaScript/collections/postundefined new file mode 100644 index 0000000000..5503981ffd --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/collections/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/collections_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/collections_{id}/deleteundefined new file mode 100644 index 0000000000..93a989b833 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/collections_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/collections_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/collections_{id}/getundefined new file mode 100644 index 0000000000..00e2c3c299 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/collections_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/collections_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/collections_{id}/postundefined new file mode 100644 index 0000000000..fd28ad77e5 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/collections_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups/getundefined b/docs/api/admin/code_samples/JavaScript/customer-groups/getundefined new file mode 100644 index 0000000000..d6cf478ef8 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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.id); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups/postundefined b/docs/api/admin/code_samples/JavaScript/customer-groups/postundefined new file mode 100644 index 0000000000..468594dcda --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/deleteundefined new file mode 100644 index 0000000000..18628e749e --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/getundefined new file mode 100644 index 0000000000..95fb6f86a1 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/postundefined new file mode 100644 index 0000000000..a8bc37a750 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers/getundefined b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers/getundefined new file mode 100644 index 0000000000..d4633c2e36 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers_batch/deleteundefined b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers_batch/deleteundefined new file mode 100644 index 0000000000..297e4d9ea6 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers_batch/deleteundefined @@ -0,0 +1,13 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers_batch/postundefined b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers_batch/postundefined new file mode 100644 index 0000000000..ff786e1b81 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customer-groups_{id}_customers_batch/postundefined @@ -0,0 +1,13 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customers/getundefined b/docs/api/admin/code_samples/JavaScript/customers/getundefined new file mode 100644 index 0000000000..74000c9a3b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customers/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customers/postundefined b/docs/api/admin/code_samples/JavaScript/customers/postundefined new file mode 100644 index 0000000000..87eb0ccd89 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customers/postundefined @@ -0,0 +1,12 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customers_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/customers_{id}/getundefined new file mode 100644 index 0000000000..d50a1c4170 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customers_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/customers_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/customers_{id}/postundefined new file mode 100644 index 0000000000..64e0ac1bb8 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/customers_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts/getundefined b/docs/api/admin/code_samples/JavaScript/discounts/getundefined new file mode 100644 index 0000000000..fece22f853 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts/postundefined b/docs/api/admin/code_samples/JavaScript/discounts/postundefined new file mode 100644 index 0000000000..f1c7752ee9 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts/postundefined @@ -0,0 +1,17 @@ +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 + }, + is_dynamic: false, + is_disabled: false +}) +.then(({ discount }) => { + console.log(discount.id); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_code_{code}/getundefined b/docs/api/admin/code_samples/JavaScript/discounts_code_{code}/getundefined new file mode 100644 index 0000000000..823da0f00e --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_code_{code}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions/postundefined b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions/postundefined new file mode 100644 index 0000000000..25723b11ef --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions/postundefined @@ -0,0 +1,10 @@ +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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/deleteundefined new file mode 100644 index 0000000000..a5998ab76b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/getundefined b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/getundefined new file mode 100644 index 0000000000..3ff5d0ded9 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/postundefined b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/postundefined new file mode 100644 index 0000000000..714dfce145 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/discounts_{id}/deleteundefined new file mode 100644 index 0000000000..4e278133f4 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/discounts_{id}/getundefined new file mode 100644 index 0000000000..e594088e8e --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/discounts_{id}/postundefined new file mode 100644 index 0000000000..1309e5cae1 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{id}_dynamic-codes/postundefined b/docs/api/admin/code_samples/JavaScript/discounts_{id}_dynamic-codes/postundefined new file mode 100644 index 0000000000..f49260dbcd --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{id}_dynamic-codes/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{id}_dynamic-codes_{code}/deleteundefined b/docs/api/admin/code_samples/JavaScript/discounts_{id}_dynamic-codes_{code}/deleteundefined new file mode 100644 index 0000000000..d73a1846df --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{id}_dynamic-codes_{code}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{id}_regions_{region_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/discounts_{id}_regions_{region_id}/deleteundefined new file mode 100644 index 0000000000..2012145590 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{id}_regions_{region_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/discounts_{id}_regions_{region_id}/postundefined b/docs/api/admin/code_samples/JavaScript/discounts_{id}_regions_{region_id}/postundefined new file mode 100644 index 0000000000..319f32d0e4 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/discounts_{id}_regions_{region_id}/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders/getundefined b/docs/api/admin/code_samples/JavaScript/draft-orders/getundefined new file mode 100644 index 0000000000..8e3a0cdf7f --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders/postundefined b/docs/api/admin/code_samples/JavaScript/draft-orders/postundefined new file mode 100644 index 0000000000..a4ab1be967 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders/postundefined @@ -0,0 +1,20 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}/deleteundefined new file mode 100644 index 0000000000..40d50928e6 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}/getundefined new file mode 100644 index 0000000000..90f6c1771a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items/postundefined b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items/postundefined new file mode 100644 index 0000000000..f3bd9ba5c4 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/deleteundefined new file mode 100644 index 0000000000..bc1cc12b59 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/postundefined b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/postundefined new file mode 100644 index 0000000000..8e8089d04f --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_pay/postundefined b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_pay/postundefined new file mode 100644 index 0000000000..e7edfa2513 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/draft-orders_{id}_pay/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/gift-cards/getundefined b/docs/api/admin/code_samples/JavaScript/gift-cards/getundefined new file mode 100644 index 0000000000..131c7d981e --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/gift-cards/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/gift-cards/postundefined b/docs/api/admin/code_samples/JavaScript/gift-cards/postundefined new file mode 100644 index 0000000000..fa255afb9f --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/gift-cards/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/deleteundefined new file mode 100644 index 0000000000..02a810bf19 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/getundefined new file mode 100644 index 0000000000..bdded76f95 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/postundefined new file mode 100644 index 0000000000..6db8476684 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/gift-cards_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/invites/getundefined b/docs/api/admin/code_samples/JavaScript/invites/getundefined new file mode 100644 index 0000000000..ec3d622aad --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/invites/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/invites/postundefined b/docs/api/admin/code_samples/JavaScript/invites/postundefined new file mode 100644 index 0000000000..846edf0e18 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/invites/postundefined @@ -0,0 +1,13 @@ +import Medusa from "@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 +}); diff --git a/docs/api/admin/code_samples/JavaScript/invites_accept/postundefined b/docs/api/admin/code_samples/JavaScript/invites_accept/postundefined new file mode 100644 index 0000000000..bdb122722b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/invites_accept/postundefined @@ -0,0 +1,17 @@ +import Medusa from "@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 +}); diff --git a/docs/api/admin/code_samples/JavaScript/invites_{invite_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/invites_{invite_id}/deleteundefined new file mode 100644 index 0000000000..c743607bfc --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/invites_{invite_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/invites_{invite_id}_resend/postundefined b/docs/api/admin/code_samples/JavaScript/invites_{invite_id}_resend/postundefined new file mode 100644 index 0000000000..2c8a380494 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/invites_{invite_id}_resend/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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 +}); diff --git a/docs/api/admin/code_samples/JavaScript/notes/getundefined b/docs/api/admin/code_samples/JavaScript/notes/getundefined new file mode 100644 index 0000000000..f8954d2d46 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/notes/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/notes/postundefined b/docs/api/admin/code_samples/JavaScript/notes/postundefined new file mode 100644 index 0000000000..0681f2e88c --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/notes/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/notes_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/notes_{id}/deleteundefined new file mode 100644 index 0000000000..5ae7c9f20b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/notes_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/notes_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/notes_{id}/getundefined new file mode 100644 index 0000000000..a47a3073ff --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/notes_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/notes_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/notes_{id}/postundefined new file mode 100644 index 0000000000..d58b21ca01 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/notes_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/notifications/getundefined b/docs/api/admin/code_samples/JavaScript/notifications/getundefined new file mode 100644 index 0000000000..ac8ed302ed --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/notifications/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/notifications_{id}_resend/postundefined b/docs/api/admin/code_samples/JavaScript/notifications_{id}_resend/postundefined new file mode 100644 index 0000000000..5021dfd6cb --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/notifications_{id}_resend/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/order_{id}_claims/postundefined b/docs/api/admin/code_samples/JavaScript/order_{id}_claims/postundefined new file mode 100644 index 0000000000..9a83e45eb8 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/order_{id}_claims/postundefined @@ -0,0 +1,15 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/order_{id}_claims_{claim_id}/postundefined b/docs/api/admin/code_samples/JavaScript/order_{id}_claims_{claim_id}/postundefined new file mode 100644 index 0000000000..5a802ab97d --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/order_{id}_claims_{claim_id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/order_{id}_swaps/postundefined b/docs/api/admin/code_samples/JavaScript/order_{id}_swaps/postundefined new file mode 100644 index 0000000000..7c0628e794 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/order_{id}_swaps/postundefined @@ -0,0 +1,14 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders/getundefined b/docs/api/admin/code_samples/JavaScript/orders/getundefined new file mode 100644 index 0000000000..18fe99ea17 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}/getundefined new file mode 100644 index 0000000000..820d03223b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}/postundefined new file mode 100644 index 0000000000..79c1fda291 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_archive/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_archive/postundefined new file mode 100644 index 0000000000..a6ed72f420 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_archive/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_cancel/postundefined new file mode 100644 index 0000000000..796f24908c --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_capture/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_capture/postundefined new file mode 100644 index 0000000000..8ed73415f0 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_capture/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_cancel/postundefined new file mode 100644 index 0000000000..c09eb3d6a9 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments/postundefined new file mode 100644 index 0000000000..9d7d51688b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined new file mode 100644 index 0000000000..c0e77a671d --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_shipments/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_shipments/postundefined new file mode 100644 index 0000000000..00dd12d1ee --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_claims_{claim_id}_shipments/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_complete/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_complete/postundefined new file mode 100644 index 0000000000..bfdb7d62c1 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_complete/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_fulfillment/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_fulfillment/postundefined new file mode 100644 index 0000000000..2646960d9b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_fulfillment/postundefined @@ -0,0 +1,14 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined new file mode 100644 index 0000000000..470a79c339 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_refund/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_refund/postundefined new file mode 100644 index 0000000000..9cc6f4d469 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_refund/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_return/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_return/postundefined new file mode 100644 index 0000000000..00fbde0ced --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_return/postundefined @@ -0,0 +1,14 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_shipment/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_shipment/postundefined new file mode 100644 index 0000000000..0dbd874fce --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_shipment/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_shipping-methods/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_shipping-methods/postundefined new file mode 100644 index 0000000000..ebe3946ad6 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_shipping-methods/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_cancel/postundefined new file mode 100644 index 0000000000..78719f5780 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments/postundefined new file mode 100644 index 0000000000..c8cfa86c08 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined new file mode 100644 index 0000000000..a34077987c --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_process-payment/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_process-payment/postundefined new file mode 100644 index 0000000000..e8d1c0b94e --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_process-payment/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_shipments/postundefined b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_shipments/postundefined new file mode 100644 index 0000000000..7cee8d2519 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/orders_{id}_swaps_{swap_id}_shipments/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists/getundefined b/docs/api/admin/code_samples/JavaScript/price-lists/getundefined new file mode 100644 index 0000000000..81a82c6ea5 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists/postundefined b/docs/api/admin/code_samples/JavaScript/price-lists/postundefined new file mode 100644 index 0000000000..e287f8c8bd --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists/postundefined @@ -0,0 +1,19 @@ +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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}/deleteundefined new file mode 100644 index 0000000000..3978dc3ac8 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}/getundefined new file mode 100644 index 0000000000..d2f3854713 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}/postundefined new file mode 100644 index 0000000000..8596feb949 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}_prices_batch/deleteundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_prices_batch/deleteundefined new file mode 100644 index 0000000000..1a6f952a6d --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_prices_batch/deleteundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}_prices_batch/postundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_prices_batch/postundefined new file mode 100644 index 0000000000..d2d0b7d737 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_prices_batch/postundefined @@ -0,0 +1,15 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}_products/getundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_products/getundefined new file mode 100644 index 0000000000..a763156022 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_products/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}_products_{product_id}_prices/deleteundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_products_{product_id}_prices/deleteundefined new file mode 100644 index 0000000000..dd16ac6335 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_products_{product_id}_prices/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/price-lists_{id}_variants_{variant_id}_prices/deleteundefined b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_variants_{variant_id}_prices/deleteundefined new file mode 100644 index 0000000000..fb0087237e --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/price-lists_{id}_variants_{variant_id}_prices/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/product-tags/getundefined b/docs/api/admin/code_samples/JavaScript/product-tags/getundefined new file mode 100644 index 0000000000..65f9fe32d7 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/product-tags/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/product-types/getundefined b/docs/api/admin/code_samples/JavaScript/product-types/getundefined new file mode 100644 index 0000000000..d379aa453c --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/product-types/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products/getundefined b/docs/api/admin/code_samples/JavaScript/products/getundefined new file mode 100644 index 0000000000..019d803217 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products/postundefined b/docs/api/admin/code_samples/JavaScript/products/postundefined new file mode 100644 index 0000000000..d5a06fc7e4 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_tag-usage/getundefined b/docs/api/admin/code_samples/JavaScript/products_tag-usage/getundefined new file mode 100644 index 0000000000..17969a2bac --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_tag-usage/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_types/getundefined b/docs/api/admin/code_samples/JavaScript/products_types/getundefined new file mode 100644 index 0000000000..a04b425c8a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_types/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/products_{id}/deleteundefined new file mode 100644 index 0000000000..a83476d557 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/products_{id}/getundefined new file mode 100644 index 0000000000..2cab9835ab --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/products_{id}/postundefined new file mode 100644 index 0000000000..0fb28bc7e2 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}_metadata/postundefined b/docs/api/admin/code_samples/JavaScript/products_{id}_metadata/postundefined new file mode 100644 index 0000000000..fc56b0eda6 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}_metadata/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}_options/postundefined b/docs/api/admin/code_samples/JavaScript/products_{id}_options/postundefined new file mode 100644 index 0000000000..ef257a4325 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}_options/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}_options_{option_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/products_{id}_options_{option_id}/deleteundefined new file mode 100644 index 0000000000..108d85da03 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}_options_{option_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}_options_{option_id}/postundefined b/docs/api/admin/code_samples/JavaScript/products_{id}_options_{option_id}/postundefined new file mode 100644 index 0000000000..414f43e789 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}_options_{option_id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}_variants/postundefined b/docs/api/admin/code_samples/JavaScript/products_{id}_variants/postundefined new file mode 100644 index 0000000000..36c1fd4111 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}_variants/postundefined @@ -0,0 +1,22 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}_variants_{variant_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/products_{id}_variants_{variant_id}/deleteundefined new file mode 100644 index 0000000000..2e163a681a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}_variants_{variant_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/products_{id}_variants_{variant_id}/postundefined b/docs/api/admin/code_samples/JavaScript/products_{id}_variants_{variant_id}/postundefined new file mode 100644 index 0000000000..d7a58d1d2c --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/products_{id}_variants_{variant_id}/postundefined @@ -0,0 +1,22 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions/getundefined b/docs/api/admin/code_samples/JavaScript/regions/getundefined new file mode 100644 index 0000000000..ba2d7532ee --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions/postundefined b/docs/api/admin/code_samples/JavaScript/regions/postundefined new file mode 100644 index 0000000000..df32a757a2 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions/postundefined @@ -0,0 +1,20 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}/deleteundefined new file mode 100644 index 0000000000..652e8da1bd --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}/getundefined new file mode 100644 index 0000000000..e16dcae311 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}/postundefined new file mode 100644 index 0000000000..e5a408f08c --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}_countries/postundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}_countries/postundefined new file mode 100644 index 0000000000..714a9839fb --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}_countries/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}_countries_{country_code}/deleteundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}_countries_{country_code}/deleteundefined new file mode 100644 index 0000000000..eb25bae15b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}_countries_{country_code}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-options/getundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-options/getundefined new file mode 100644 index 0000000000..16af32b21d --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-options/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-providers/postundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-providers/postundefined new file mode 100644 index 0000000000..525df6f5f1 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-providers/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined new file mode 100644 index 0000000000..cc4175c3b8 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}_payment-providers/postundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}_payment-providers/postundefined new file mode 100644 index 0000000000..3eebefc244 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}_payment-providers/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/regions_{id}_payment-providers_{provider_id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/regions_{id}_payment-providers_{provider_id}/deleteundefined new file mode 100644 index 0000000000..b6d628bdb0 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/regions_{id}_payment-providers_{provider_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/return-reasons/getundefined b/docs/api/admin/code_samples/JavaScript/return-reasons/getundefined new file mode 100644 index 0000000000..ebcc0e0029 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/return-reasons/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/return-reasons/postundefined b/docs/api/admin/code_samples/JavaScript/return-reasons/postundefined new file mode 100644 index 0000000000..49fe4c5b3f --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/return-reasons/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/deleteundefined new file mode 100644 index 0000000000..33ad40e0d5 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/getundefined new file mode 100644 index 0000000000..c1ee97d4c0 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/postundefined new file mode 100644 index 0000000000..2e8dd0d369 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/return-reasons_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/returns/getundefined b/docs/api/admin/code_samples/JavaScript/returns/getundefined new file mode 100644 index 0000000000..956b17b8f7 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/returns/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/returns_{id}_cancel/postundefined b/docs/api/admin/code_samples/JavaScript/returns_{id}_cancel/postundefined new file mode 100644 index 0000000000..1966cc48bb --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/returns_{id}_cancel/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/returns_{id}_receive/postundefined b/docs/api/admin/code_samples/JavaScript/returns_{id}_receive/postundefined new file mode 100644 index 0000000000..d77c23d252 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/returns_{id}_receive/postundefined @@ -0,0 +1,14 @@ +import Medusa from "@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(({ return }) => { + console.log(return.id); +}); diff --git a/docs/api/admin/code_samples/JavaScript/sales-channels/getundefined b/docs/api/admin/code_samples/JavaScript/sales-channels/getundefined new file mode 100644 index 0000000000..e2ff907f23 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/sales-channels/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/sales-channels/postundefined b/docs/api/admin/code_samples/JavaScript/sales-channels/postundefined new file mode 100644 index 0000000000..7272e7ebd3 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/sales-channels/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/deleteundefined new file mode 100644 index 0000000000..69cfc064e6 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/getundefined new file mode 100644 index 0000000000..a80a3790d7 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/postundefined new file mode 100644 index 0000000000..8859a4a8a0 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/sales-channels_{id}_products_batch/deleteundefined b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}_products_batch/deleteundefined new file mode 100644 index 0000000000..35e9355f55 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}_products_batch/deleteundefined @@ -0,0 +1,13 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/sales-channels_{id}_products_batch/postundefined b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}_products_batch/postundefined new file mode 100644 index 0000000000..e2d8c57d61 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/sales-channels_{id}_products_batch/postundefined @@ -0,0 +1,13 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-options/getundefined b/docs/api/admin/code_samples/JavaScript/shipping-options/getundefined new file mode 100644 index 0000000000..2318c1afd4 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-options/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-options/postundefined b/docs/api/admin/code_samples/JavaScript/shipping-options/postundefined new file mode 100644 index 0000000000..0559379cfd --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-options/postundefined @@ -0,0 +1,14 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/deleteundefined new file mode 100644 index 0000000000..3ffaba5bcf --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/getundefined new file mode 100644 index 0000000000..35580fb6ed --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/postundefined new file mode 100644 index 0000000000..4dba9b7cc5 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-options_{id}/postundefined @@ -0,0 +1,16 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-profiles/getundefined b/docs/api/admin/code_samples/JavaScript/shipping-profiles/getundefined new file mode 100644 index 0000000000..39c4e65180 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-profiles/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-profiles/postundefined b/docs/api/admin/code_samples/JavaScript/shipping-profiles/postundefined new file mode 100644 index 0000000000..dc7216640c --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-profiles/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/deleteundefined new file mode 100644 index 0000000000..c29b6cfd85 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/getundefined new file mode 100644 index 0000000000..169466b9bd --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/postundefined new file mode 100644 index 0000000000..a1d9d7b9b0 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/shipping-profiles_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/store/getundefined b/docs/api/admin/code_samples/JavaScript/store/getundefined new file mode 100644 index 0000000000..98075c1e6a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/store/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/store/postundefined b/docs/api/admin/code_samples/JavaScript/store/postundefined new file mode 100644 index 0000000000..b21747b0ac --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/store/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/store_currencies_{code}/deleteundefined b/docs/api/admin/code_samples/JavaScript/store_currencies_{code}/deleteundefined new file mode 100644 index 0000000000..153d5ccaea --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/store_currencies_{code}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/store_currencies_{code}/postundefined b/docs/api/admin/code_samples/JavaScript/store_currencies_{code}/postundefined new file mode 100644 index 0000000000..104d443ddb --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/store_currencies_{code}/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/store_payment-providers/getundefined b/docs/api/admin/code_samples/JavaScript/store_payment-providers/getundefined new file mode 100644 index 0000000000..faa67b4447 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/store_payment-providers/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/store_tax-providers/getundefined b/docs/api/admin/code_samples/JavaScript/store_tax-providers/getundefined new file mode 100644 index 0000000000..2fc472fe98 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/store_tax-providers/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/swaps/getundefined b/docs/api/admin/code_samples/JavaScript/swaps/getundefined new file mode 100644 index 0000000000..2f68e11799 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/swaps/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/swaps_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/swaps_{id}/getundefined new file mode 100644 index 0000000000..de7a6276b4 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/swaps_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates/getundefined b/docs/api/admin/code_samples/JavaScript/tax-rates/getundefined new file mode 100644 index 0000000000..d80de4ad90 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates/postundefined b/docs/api/admin/code_samples/JavaScript/tax-rates/postundefined new file mode 100644 index 0000000000..2ca559a25b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/deleteundefined new file mode 100644 index 0000000000..4ef3395248 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/getundefined new file mode 100644 index 0000000000..244317ebcf --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/postundefined new file mode 100644 index 0000000000..40ceb0c3c5 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_product-types_batch/deleteundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_product-types_batch/deleteundefined new file mode 100644 index 0000000000..60c7e61b08 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_product-types_batch/deleteundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_product-types_batch/postundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_product-types_batch/postundefined new file mode 100644 index 0000000000..55da7e8ff1 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_product-types_batch/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_products_batch/deleteundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_products_batch/deleteundefined new file mode 100644 index 0000000000..fd05e8175f --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_products_batch/deleteundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_products_batch/postundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_products_batch/postundefined new file mode 100644 index 0000000000..4bbafda08b --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_products_batch/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/deleteundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/deleteundefined new file mode 100644 index 0000000000..fc8dc08e7a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/deleteundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/postundefined b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/postundefined new file mode 100644 index 0000000000..8cf86df693 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/uploads/postundefined b/docs/api/admin/code_samples/JavaScript/uploads/postundefined new file mode 100644 index 0000000000..67a54930b0 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/uploads/postundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/users/getundefined b/docs/api/admin/code_samples/JavaScript/users/getundefined new file mode 100644 index 0000000000..38d9ada2ab --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/users/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/users/postundefined b/docs/api/admin/code_samples/JavaScript/users/postundefined new file mode 100644 index 0000000000..b842c551bc --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/users/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/users_password-token/postundefined b/docs/api/admin/code_samples/JavaScript/users_password-token/postundefined new file mode 100644 index 0000000000..1bc09ed2c1 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/users_password-token/postundefined @@ -0,0 +1,12 @@ +import Medusa from "@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 +}); diff --git a/docs/api/admin/code_samples/JavaScript/users_reset-password/postundefined b/docs/api/admin/code_samples/JavaScript/users_reset-password/postundefined new file mode 100644 index 0000000000..00f8683c66 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/users_reset-password/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/users_{id}/deleteundefined b/docs/api/admin/code_samples/JavaScript/users_{id}/deleteundefined new file mode 100644 index 0000000000..d33f7acd3a --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/users_{id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/users_{id}/getundefined b/docs/api/admin/code_samples/JavaScript/users_{id}/getundefined new file mode 100644 index 0000000000..4b1aacff2d --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/users_{id}/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/users_{id}/postundefined b/docs/api/admin/code_samples/JavaScript/users_{id}/postundefined new file mode 100644 index 0000000000..105e42acea --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/users_{id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/JavaScript/variants/getundefined b/docs/api/admin/code_samples/JavaScript/variants/getundefined new file mode 100644 index 0000000000..efcf6f97d0 --- /dev/null +++ b/docs/api/admin/code_samples/JavaScript/variants/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@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); +}); diff --git a/docs/api/admin/code_samples/Shell/admin_draft-orders_{id}/postundefined b/docs/api/admin/code_samples/Shell/admin_draft-orders_{id}/postundefined new file mode 100644 index 0000000000..b61a2ff953 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/admin_draft-orders_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/apps/getundefined b/docs/api/admin/code_samples/Shell/apps/getundefined new file mode 100644 index 0000000000..e9f3cbfd4b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/apps/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/apps' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/apps_authorizations/postundefined b/docs/api/admin/code_samples/Shell/apps_authorizations/postundefined new file mode 100644 index 0000000000..77b8e41f30 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/apps_authorizations/postundefined @@ -0,0 +1,8 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/auth/deleteundefined b/docs/api/admin/code_samples/Shell/auth/deleteundefined new file mode 100644 index 0000000000..1b7aa8e1af --- /dev/null +++ b/docs/api/admin/code_samples/Shell/auth/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/auth' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/auth/getundefined b/docs/api/admin/code_samples/Shell/auth/getundefined new file mode 100644 index 0000000000..c396a333ef --- /dev/null +++ b/docs/api/admin/code_samples/Shell/auth/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/auth' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/auth/postundefined b/docs/api/admin/code_samples/Shell/auth/postundefined new file mode 100644 index 0000000000..5a9d09b774 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/auth/postundefined @@ -0,0 +1,6 @@ +curl --location --request POST 'https://medusa-url.com/admin/auth' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "email": "user@example.com", + "password": "supersecret" +}' diff --git a/docs/api/admin/code_samples/Shell/batch-jobs/getundefined b/docs/api/admin/code_samples/Shell/batch-jobs/getundefined new file mode 100644 index 0000000000..6031fa39e2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/batch-jobs/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/batch-jobs' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/batch-jobs/postundefined b/docs/api/admin/code_samples/Shell/batch-jobs/postundefined new file mode 100644 index 0000000000..e912301db7 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/batch-jobs/postundefined @@ -0,0 +1,7 @@ +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": { } +}' diff --git a/docs/api/admin/code_samples/Shell/batch-jobs_{id}/getundefined b/docs/api/admin/code_samples/Shell/batch-jobs_{id}/getundefined new file mode 100644 index 0000000000..bd63e8285b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/batch-jobs_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/batch-jobs/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/batch-jobs_{id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/batch-jobs_{id}_cancel/postundefined new file mode 100644 index 0000000000..a7441d43d6 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/batch-jobs_{id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/batch-jobs/{id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/batch-jobs_{id}_confirm/postundefined b/docs/api/admin/code_samples/Shell/batch-jobs_{id}_confirm/postundefined new file mode 100644 index 0000000000..08d4f63cc7 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/batch-jobs_{id}_confirm/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/batch-jobs/{id}/confirm' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/collections/getundefined b/docs/api/admin/code_samples/Shell/collections/getundefined new file mode 100644 index 0000000000..453d7ac39d --- /dev/null +++ b/docs/api/admin/code_samples/Shell/collections/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/collections' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/collections/postundefined b/docs/api/admin/code_samples/Shell/collections/postundefined new file mode 100644 index 0000000000..5c44e23be9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/collections/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/collections_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/collections_{id}/deleteundefined new file mode 100644 index 0000000000..14a3181174 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/collections_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/collections/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/collections_{id}/getundefined b/docs/api/admin/code_samples/Shell/collections_{id}/getundefined new file mode 100644 index 0000000000..5ae08e69c4 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/collections_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/collections/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/collections_{id}/postundefined b/docs/api/admin/code_samples/Shell/collections_{id}/postundefined new file mode 100644 index 0000000000..c6c54dc726 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/collections_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/collections_{id}_products_batch/deleteundefined b/docs/api/admin/code_samples/Shell/collections_{id}_products_batch/deleteundefined new file mode 100644 index 0000000000..bb535f5d71 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/collections_{id}_products_batch/deleteundefined @@ -0,0 +1,8 @@ +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" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/collections_{id}_products_batch/postundefined b/docs/api/admin/code_samples/Shell/collections_{id}_products_batch/postundefined new file mode 100644 index 0000000000..5d72595716 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/collections_{id}_products_batch/postundefined @@ -0,0 +1,8 @@ +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" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups/getundefined b/docs/api/admin/code_samples/Shell/customer-groups/getundefined new file mode 100644 index 0000000000..a5048c37cd --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/customer-groups' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups/postundefined b/docs/api/admin/code_samples/Shell/customer-groups/postundefined new file mode 100644 index 0000000000..966d8e3d37 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/customer-groups_{id}/deleteundefined new file mode 100644 index 0000000000..2c52c84d62 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/customer-groups/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups_{id}/getundefined b/docs/api/admin/code_samples/Shell/customer-groups_{id}/getundefined new file mode 100644 index 0000000000..a3cf8abe1f --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/customer-groups/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups_{id}/postundefined b/docs/api/admin/code_samples/Shell/customer-groups_{id}/postundefined new file mode 100644 index 0000000000..6f6248f25c --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers/getundefined b/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers/getundefined new file mode 100644 index 0000000000..90cdfe78c5 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/customer-groups/{id}/customers' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers_batch/deleteundefined b/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers_batch/deleteundefined new file mode 100644 index 0000000000..2236bfc611 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers_batch/deleteundefined @@ -0,0 +1,10 @@ +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" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers_batch/postundefined b/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers_batch/postundefined new file mode 100644 index 0000000000..29d0e6c579 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customer-groups_{id}_customers_batch/postundefined @@ -0,0 +1,10 @@ +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" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/customers/getundefined b/docs/api/admin/code_samples/Shell/customers/getundefined new file mode 100644 index 0000000000..7d881eb71a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customers/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/customers' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/customers/postundefined b/docs/api/admin/code_samples/Shell/customers/postundefined new file mode 100644 index 0000000000..f519c48961 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customers/postundefined @@ -0,0 +1,9 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/customers_{id}/getundefined b/docs/api/admin/code_samples/Shell/customers_{id}/getundefined new file mode 100644 index 0000000000..c512e934e3 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customers_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/customers/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/customers_{id}/postundefined b/docs/api/admin/code_samples/Shell/customers_{id}/postundefined new file mode 100644 index 0000000000..8114b453f9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/customers_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/discounts/getundefined b/docs/api/admin/code_samples/Shell/discounts/getundefined new file mode 100644 index 0000000000..56ddb9fc0d --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/discounts' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts/postundefined b/docs/api/admin/code_samples/Shell/discounts/postundefined new file mode 100644 index 0000000000..acfcb88663 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts/postundefined @@ -0,0 +1,11 @@ +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" + } +}' diff --git a/docs/api/admin/code_samples/Shell/discounts_code_{code}/getundefined b/docs/api/admin/code_samples/Shell/discounts_code_{code}/getundefined new file mode 100644 index 0000000000..303d1d988e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_code_{code}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/discounts/code/{code}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions/postundefined b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions/postundefined new file mode 100644 index 0000000000..2f940df020 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/deleteundefined b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/deleteundefined new file mode 100644 index 0000000000..4d93337752 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/getundefined b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/getundefined new file mode 100644 index 0000000000..e966519363 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/postundefined b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/postundefined new file mode 100644 index 0000000000..5589b208ad --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/postundefined @@ -0,0 +1,8 @@ +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" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/discounts_{id}/deleteundefined new file mode 100644 index 0000000000..e3942cdfe5 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{id}/getundefined b/docs/api/admin/code_samples/Shell/discounts_{id}/getundefined new file mode 100644 index 0000000000..b5fe6fa2f2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/discounts/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{id}/postundefined b/docs/api/admin/code_samples/Shell/discounts_{id}/postundefined new file mode 100644 index 0000000000..8a2a6f7025 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{id}_dynamic-codes/postundefined b/docs/api/admin/code_samples/Shell/discounts_{id}_dynamic-codes/postundefined new file mode 100644 index 0000000000..fdf631bbc2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{id}_dynamic-codes/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{id}_dynamic-codes_{code}/deleteundefined b/docs/api/admin/code_samples/Shell/discounts_{id}_dynamic-codes_{code}/deleteundefined new file mode 100644 index 0000000000..c24e818ac1 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{id}_dynamic-codes_{code}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}/dynamic-codes/{code}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{id}_regions_{region_id}/deleteundefined b/docs/api/admin/code_samples/Shell/discounts_{id}_regions_{region_id}/deleteundefined new file mode 100644 index 0000000000..ef471b2353 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{id}_regions_{region_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/discounts_{id}_regions_{region_id}/postundefined b/docs/api/admin/code_samples/Shell/discounts_{id}_regions_{region_id}/postundefined new file mode 100644 index 0000000000..e3aa97a564 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/discounts_{id}_regions_{region_id}/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders/getundefined b/docs/api/admin/code_samples/Shell/draft-orders/getundefined new file mode 100644 index 0000000000..aa7ed7a4ca --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/draft-orders' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders/postundefined b/docs/api/admin/code_samples/Shell/draft-orders/postundefined new file mode 100644 index 0000000000..a332712dbd --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders/postundefined @@ -0,0 +1,17 @@ +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}" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/draft-orders_{id}/deleteundefined new file mode 100644 index 0000000000..58b5d78524 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/draft-orders/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders_{id}/getundefined b/docs/api/admin/code_samples/Shell/draft-orders_{id}/getundefined new file mode 100644 index 0000000000..d3d5f473a2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/draft-orders/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items/postundefined b/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items/postundefined new file mode 100644 index 0000000000..e69f38c203 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items/postundefined @@ -0,0 +1,6 @@ +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 +}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items_{line_id}/deleteundefined b/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items_{line_id}/deleteundefined new file mode 100644 index 0000000000..637f1b6445 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items_{line_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items_{line_id}/postundefined b/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items_{line_id}/postundefined new file mode 100644 index 0000000000..f27e67dff8 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders_{id}_line-items_{line_id}/postundefined @@ -0,0 +1,6 @@ +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 +}' diff --git a/docs/api/admin/code_samples/Shell/draft-orders_{id}_pay/postundefined b/docs/api/admin/code_samples/Shell/draft-orders_{id}_pay/postundefined new file mode 100644 index 0000000000..f3a2d6894f --- /dev/null +++ b/docs/api/admin/code_samples/Shell/draft-orders_{id}_pay/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/draft-orders/{id}/pay' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/gift-cards/getundefined b/docs/api/admin/code_samples/Shell/gift-cards/getundefined new file mode 100644 index 0000000000..0318549eaa --- /dev/null +++ b/docs/api/admin/code_samples/Shell/gift-cards/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/gift-cards' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/gift-cards/postundefined b/docs/api/admin/code_samples/Shell/gift-cards/postundefined new file mode 100644 index 0000000000..d5994f38b9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/gift-cards/postundefined @@ -0,0 +1,6 @@ +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}" +}' diff --git a/docs/api/admin/code_samples/Shell/gift-cards_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/gift-cards_{id}/deleteundefined new file mode 100644 index 0000000000..ef924b3574 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/gift-cards_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/gift-cards/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/gift-cards_{id}/getundefined b/docs/api/admin/code_samples/Shell/gift-cards_{id}/getundefined new file mode 100644 index 0000000000..09bcb294b9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/gift-cards_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/gift-cards/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/gift-cards_{id}/postundefined b/docs/api/admin/code_samples/Shell/gift-cards_{id}/postundefined new file mode 100644 index 0000000000..fbf48d4f9e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/gift-cards_{id}/postundefined @@ -0,0 +1,6 @@ +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}" +}' diff --git a/docs/api/admin/code_samples/Shell/invites/getundefined b/docs/api/admin/code_samples/Shell/invites/getundefined new file mode 100644 index 0000000000..6b00b3ff47 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/invites/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/invites' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/invites/postundefined b/docs/api/admin/code_samples/Shell/invites/postundefined new file mode 100644 index 0000000000..8fec9cc475 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/invites/postundefined @@ -0,0 +1,7 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/invites_accept/postundefined b/docs/api/admin/code_samples/Shell/invites_accept/postundefined new file mode 100644 index 0000000000..1f53c0081b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/invites_accept/postundefined @@ -0,0 +1,11 @@ +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" + } +}' diff --git a/docs/api/admin/code_samples/Shell/invites_{invite_id}/deleteundefined b/docs/api/admin/code_samples/Shell/invites_{invite_id}/deleteundefined new file mode 100644 index 0000000000..a400c35b0c --- /dev/null +++ b/docs/api/admin/code_samples/Shell/invites_{invite_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/invites/{invite_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/invites_{invite_id}_resend/postundefined b/docs/api/admin/code_samples/Shell/invites_{invite_id}_resend/postundefined new file mode 100644 index 0000000000..c602788617 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/invites_{invite_id}_resend/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/invites/{invite_id}/resend' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/notes/getundefined b/docs/api/admin/code_samples/Shell/notes/getundefined new file mode 100644 index 0000000000..b8f342b1c6 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/notes/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/notes' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/notes/postundefined b/docs/api/admin/code_samples/Shell/notes/postundefined new file mode 100644 index 0000000000..941883941e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/notes/postundefined @@ -0,0 +1,8 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/notes_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/notes_{id}/deleteundefined new file mode 100644 index 0000000000..6022941b0b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/notes_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/notes/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/notes_{id}/getundefined b/docs/api/admin/code_samples/Shell/notes_{id}/getundefined new file mode 100644 index 0000000000..8eb3390421 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/notes_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/notes/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/notes_{id}/postundefined b/docs/api/admin/code_samples/Shell/notes_{id}/postundefined new file mode 100644 index 0000000000..16b9501595 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/notes_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/notifications/getundefined b/docs/api/admin/code_samples/Shell/notifications/getundefined new file mode 100644 index 0000000000..58da1ac1e8 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/notifications/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/notifications' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/notifications_{id}_resend/postundefined b/docs/api/admin/code_samples/Shell/notifications_{id}_resend/postundefined new file mode 100644 index 0000000000..eea4a4fe51 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/notifications_{id}_resend/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/notifications/{id}/resend' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/order_{id}_claims/postundefined b/docs/api/admin/code_samples/Shell/order_{id}_claims/postundefined new file mode 100644 index 0000000000..740dcec04d --- /dev/null +++ b/docs/api/admin/code_samples/Shell/order_{id}_claims/postundefined @@ -0,0 +1,12 @@ +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 + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/order_{id}_claims_{claim_id}/postundefined b/docs/api/admin/code_samples/Shell/order_{id}_claims_{claim_id}/postundefined new file mode 100644 index 0000000000..5e8c065532 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/order_{id}_claims_{claim_id}/postundefined @@ -0,0 +1,6 @@ +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 +}' diff --git a/docs/api/admin/code_samples/Shell/order_{id}_swaps/postundefined b/docs/api/admin/code_samples/Shell/order_{id}_swaps/postundefined new file mode 100644 index 0000000000..05d7956247 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/order_{id}_swaps/postundefined @@ -0,0 +1,11 @@ +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 + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/orders/getundefined b/docs/api/admin/code_samples/Shell/orders/getundefined new file mode 100644 index 0000000000..da90d88126 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/orders' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}/getundefined b/docs/api/admin/code_samples/Shell/orders_{id}/getundefined new file mode 100644 index 0000000000..31061a7d1d --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/orders/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}/postundefined new file mode 100644 index 0000000000..fe9eec7ec0 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_archive/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_archive/postundefined new file mode 100644 index 0000000000..16f952b60d --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_archive/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/archive' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_cancel/postundefined new file mode 100644 index 0000000000..3bd1fb9e59 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_capture/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_capture/postundefined new file mode 100644 index 0000000000..2b756505ca --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_capture/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/capture' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_cancel/postundefined new file mode 100644 index 0000000000..ce2c338ca2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments/postundefined new file mode 100644 index 0000000000..186fae177e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined new file mode 100644 index 0000000000..70251d2655 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_shipments/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_shipments/postundefined new file mode 100644 index 0000000000..500f60537b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_claims_{claim_id}_shipments/postundefined @@ -0,0 +1,6 @@ +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}" +}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_complete/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_complete/postundefined new file mode 100644 index 0000000000..face961e8a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_complete/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/complete' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_fulfillment/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_fulfillment/postundefined new file mode 100644 index 0000000000..986ae9845c --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_fulfillment/postundefined @@ -0,0 +1,11 @@ +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 + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined new file mode 100644 index 0000000000..329baafca2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/fulfillments/{fulfillment_id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_refund/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_refund/postundefined new file mode 100644 index 0000000000..c3861c12f0 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_refund/postundefined @@ -0,0 +1,7 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_return/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_return/postundefined new file mode 100644 index 0000000000..7f404dcd2b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_return/postundefined @@ -0,0 +1,11 @@ +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 + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_shipment/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_shipment/postundefined new file mode 100644 index 0000000000..3ce9d0dbe2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_shipment/postundefined @@ -0,0 +1,6 @@ +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}" +}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_shipping-methods/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_shipping-methods/postundefined new file mode 100644 index 0000000000..af64417d03 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_shipping-methods/postundefined @@ -0,0 +1,7 @@ +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}" +}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_cancel/postundefined new file mode 100644 index 0000000000..3ab73a66e1 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{order_id}/swaps/{swap_id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments/postundefined new file mode 100644 index 0000000000..e0c7c80d87 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined new file mode 100644 index 0000000000..9028ae28d3 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_process-payment/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_process-payment/postundefined new file mode 100644 index 0000000000..25c26acf15 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_process-payment/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/process-payment' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_shipments/postundefined b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_shipments/postundefined new file mode 100644 index 0000000000..05d727ac7f --- /dev/null +++ b/docs/api/admin/code_samples/Shell/orders_{id}_swaps_{swap_id}_shipments/postundefined @@ -0,0 +1,6 @@ +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}" +}' diff --git a/docs/api/admin/code_samples/Shell/price-lists/getundefined b/docs/api/admin/code_samples/Shell/price-lists/getundefined new file mode 100644 index 0000000000..c748eb2f93 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/price-lists' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/price-lists/postundefined b/docs/api/admin/code_samples/Shell/price-lists/postundefined new file mode 100644 index 0000000000..9220782166 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists/postundefined @@ -0,0 +1,15 @@ +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" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}/deleteundefined new file mode 100644 index 0000000000..56b417ec43 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/price-lists/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}/getundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}/getundefined new file mode 100644 index 0000000000..f2cb825fbc --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/price-lists/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}/postundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}/postundefined new file mode 100644 index 0000000000..6b567a4234 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}_prices_batch/deleteundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}_prices_batch/deleteundefined new file mode 100644 index 0000000000..d0afcd6475 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}_prices_batch/deleteundefined @@ -0,0 +1,8 @@ +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" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}_prices_batch/postundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}_prices_batch/postundefined new file mode 100644 index 0000000000..f96de18054 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}_prices_batch/postundefined @@ -0,0 +1,12 @@ +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" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}_products/getundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}_products/getundefined new file mode 100644 index 0000000000..573fdc6d1c --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}_products/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/price-lists/{id}/products' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}_products_{product_id}_prices/deleteundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}_products_{product_id}_prices/deleteundefined new file mode 100644 index 0000000000..1bc7ceaa33 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}_products_{product_id}_prices/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/price-lists/{id}/products/{product_id}/prices' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/price-lists_{id}_variants_{variant_id}_prices/deleteundefined b/docs/api/admin/code_samples/Shell/price-lists_{id}_variants_{variant_id}_prices/deleteundefined new file mode 100644 index 0000000000..53b958b813 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/price-lists_{id}_variants_{variant_id}_prices/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/price-lists/{id}/variants/{variant_id}/prices' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/product-tags/getundefined b/docs/api/admin/code_samples/Shell/product-tags/getundefined new file mode 100644 index 0000000000..904ad3a752 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/product-tags/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/product-tags' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/product-types/getundefined b/docs/api/admin/code_samples/Shell/product-types/getundefined new file mode 100644 index 0000000000..c694461e93 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/product-types/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/product-types' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products/getundefined b/docs/api/admin/code_samples/Shell/products/getundefined new file mode 100644 index 0000000000..055991a2d9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/products' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products/postundefined b/docs/api/admin/code_samples/Shell/products/postundefined new file mode 100644 index 0000000000..896c192d81 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products/postundefined @@ -0,0 +1,6 @@ +curl --location --request POST 'https://medusa-url.com/admin/products' \ +--header 'Authorization: Bearer {api_token}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "title": "Shirt" +}' diff --git a/docs/api/admin/code_samples/Shell/products_tag-usage/getundefined b/docs/api/admin/code_samples/Shell/products_tag-usage/getundefined new file mode 100644 index 0000000000..200d6de0be --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_tag-usage/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/products/tag-usage' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products_types/getundefined b/docs/api/admin/code_samples/Shell/products_types/getundefined new file mode 100644 index 0000000000..10f093aa0b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_types/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/products/types' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/products_{id}/deleteundefined new file mode 100644 index 0000000000..0d38583ed4 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/products/asfsaf' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}/getundefined b/docs/api/admin/code_samples/Shell/products_{id}/getundefined new file mode 100644 index 0000000000..abc8f8e395 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/products/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}/postundefined b/docs/api/admin/code_samples/Shell/products_{id}/postundefined new file mode 100644 index 0000000000..6af08c0c74 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_metadata/postundefined b/docs/api/admin/code_samples/Shell/products_{id}_metadata/postundefined new file mode 100644 index 0000000000..8b3c2a6539 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_metadata/postundefined @@ -0,0 +1,7 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_options/postundefined b/docs/api/admin/code_samples/Shell/products_{id}_options/postundefined new file mode 100644 index 0000000000..c21addc0bc --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_options/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_options_{option_id}/deleteundefined b/docs/api/admin/code_samples/Shell/products_{id}_options_{option_id}/deleteundefined new file mode 100644 index 0000000000..0540a983dd --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_options_{option_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/products/{id}/options/{option_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_options_{option_id}/postundefined b/docs/api/admin/code_samples/Shell/products_{id}_options_{option_id}/postundefined new file mode 100644 index 0000000000..b100239fe9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_options_{option_id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_variants/getundefined b/docs/api/admin/code_samples/Shell/products_{id}_variants/getundefined new file mode 100644 index 0000000000..4a5b3ec1ed --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_variants/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/products/{id}/variants' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_variants/postundefined b/docs/api/admin/code_samples/Shell/products_{id}_variants/postundefined new file mode 100644 index 0000000000..41f4cbce2a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_variants/postundefined @@ -0,0 +1,18 @@ +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" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_variants_{variant_id}/deleteundefined b/docs/api/admin/code_samples/Shell/products_{id}_variants_{variant_id}/deleteundefined new file mode 100644 index 0000000000..e64e3e5181 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_variants_{variant_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/products/{id}/variants/{variant_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/products_{id}_variants_{variant_id}/postundefined b/docs/api/admin/code_samples/Shell/products_{id}_variants_{variant_id}/postundefined new file mode 100644 index 0000000000..652175da6e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/products_{id}_variants_{variant_id}/postundefined @@ -0,0 +1,12 @@ +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" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/regions/getundefined b/docs/api/admin/code_samples/Shell/regions/getundefined new file mode 100644 index 0000000000..fb80731951 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/regions' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/regions/postundefined b/docs/api/admin/code_samples/Shell/regions/postundefined new file mode 100644 index 0000000000..f71a7c66a3 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions/postundefined @@ -0,0 +1,17 @@ +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" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/regions_{id}/deleteundefined new file mode 100644 index 0000000000..bd6e9561c6 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/regions/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}/getundefined b/docs/api/admin/code_samples/Shell/regions_{id}/getundefined new file mode 100644 index 0000000000..7b2c2db4b3 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/regions/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}/postundefined b/docs/api/admin/code_samples/Shell/regions_{id}/postundefined new file mode 100644 index 0000000000..223c0f932a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}_countries/postundefined b/docs/api/admin/code_samples/Shell/regions_{id}_countries/postundefined new file mode 100644 index 0000000000..0390c04b6f --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}_countries/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}_countries_{country_code}/deleteundefined b/docs/api/admin/code_samples/Shell/regions_{id}_countries_{country_code}/deleteundefined new file mode 100644 index 0000000000..4797a1a513 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}_countries_{country_code}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/regions/{id}/countries/dk' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-options/getundefined b/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-options/getundefined new file mode 100644 index 0000000000..c07fcb7d6d --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-options/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/regions/{id}/fulfillment-options' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-providers/postundefined b/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-providers/postundefined new file mode 100644 index 0000000000..1f4d79e6cd --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-providers/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined b/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined new file mode 100644 index 0000000000..72360c5976 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/regions/{id}/fulfillment-providers/manual' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}_payment-providers/postundefined b/docs/api/admin/code_samples/Shell/regions_{id}_payment-providers/postundefined new file mode 100644 index 0000000000..cacf292ebc --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}_payment-providers/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/regions_{id}_payment-providers_{provider_id}/deleteundefined b/docs/api/admin/code_samples/Shell/regions_{id}_payment-providers_{provider_id}/deleteundefined new file mode 100644 index 0000000000..27321ae0ec --- /dev/null +++ b/docs/api/admin/code_samples/Shell/regions_{id}_payment-providers_{provider_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/regions/{id}/payment-providers/manual' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/return-reasons/getundefined b/docs/api/admin/code_samples/Shell/return-reasons/getundefined new file mode 100644 index 0000000000..7ee55fefab --- /dev/null +++ b/docs/api/admin/code_samples/Shell/return-reasons/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/return-reasons' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/return-reasons/postundefined b/docs/api/admin/code_samples/Shell/return-reasons/postundefined new file mode 100644 index 0000000000..8c18f704c8 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/return-reasons/postundefined @@ -0,0 +1,7 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/return-reasons_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/return-reasons_{id}/deleteundefined new file mode 100644 index 0000000000..996dc6343e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/return-reasons_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/return-reasons/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/return-reasons_{id}/getundefined b/docs/api/admin/code_samples/Shell/return-reasons_{id}/getundefined new file mode 100644 index 0000000000..15b08a3c1a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/return-reasons_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/return-reasons/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/return-reasons_{id}/postundefined b/docs/api/admin/code_samples/Shell/return-reasons_{id}/postundefined new file mode 100644 index 0000000000..c11a92f929 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/return-reasons_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/returns/getundefined b/docs/api/admin/code_samples/Shell/returns/getundefined new file mode 100644 index 0000000000..060dbc3885 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/returns/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/returns' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/returns_{id}_cancel/postundefined b/docs/api/admin/code_samples/Shell/returns_{id}_cancel/postundefined new file mode 100644 index 0000000000..67d0a2ac06 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/returns_{id}_cancel/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/returns/{id}/cancel' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/returns_{id}_receive/postundefined b/docs/api/admin/code_samples/Shell/returns_{id}_receive/postundefined new file mode 100644 index 0000000000..c4eaefca16 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/returns_{id}_receive/postundefined @@ -0,0 +1,11 @@ +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 + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/sales-channels/getundefined b/docs/api/admin/code_samples/Shell/sales-channels/getundefined new file mode 100644 index 0000000000..24782baea9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/sales-channels/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/sales-channels' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/sales-channels/postundefined b/docs/api/admin/code_samples/Shell/sales-channels/postundefined new file mode 100644 index 0000000000..97b8eff3f6 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/sales-channels/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/sales-channels_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/sales-channels_{id}/deleteundefined new file mode 100644 index 0000000000..2137590f84 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/sales-channels_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/sales-channels/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/sales-channels_{id}/getundefined b/docs/api/admin/code_samples/Shell/sales-channels_{id}/getundefined new file mode 100644 index 0000000000..10a811a10a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/sales-channels_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/sales-channels/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/sales-channels_{id}/postundefined b/docs/api/admin/code_samples/Shell/sales-channels_{id}/postundefined new file mode 100644 index 0000000000..a26d506361 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/sales-channels_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/sales-channels_{id}_products_batch/deleteundefined b/docs/api/admin/code_samples/Shell/sales-channels_{id}_products_batch/deleteundefined new file mode 100644 index 0000000000..fe3b16bda1 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/sales-channels_{id}_products_batch/deleteundefined @@ -0,0 +1,10 @@ +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}" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/sales-channels_{id}_products_batch/postundefined b/docs/api/admin/code_samples/Shell/sales-channels_{id}_products_batch/postundefined new file mode 100644 index 0000000000..b9e4a32fd3 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/sales-channels_{id}_products_batch/postundefined @@ -0,0 +1,10 @@ +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}" + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/shipping-options/getundefined b/docs/api/admin/code_samples/Shell/shipping-options/getundefined new file mode 100644 index 0000000000..2e749082ef --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-options/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/shipping-options' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/shipping-options/postundefined b/docs/api/admin/code_samples/Shell/shipping-options/postundefined new file mode 100644 index 0000000000..77d68a91dd --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-options/postundefined @@ -0,0 +1,10 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/shipping-options_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/shipping-options_{id}/deleteundefined new file mode 100644 index 0000000000..ca615dfc32 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-options_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/shipping-options/{option_id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/shipping-options_{id}/getundefined b/docs/api/admin/code_samples/Shell/shipping-options_{id}/getundefined new file mode 100644 index 0000000000..852768184b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-options_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/shipping-options/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/shipping-options_{id}/postundefined b/docs/api/admin/code_samples/Shell/shipping-options_{id}/postundefined new file mode 100644 index 0000000000..d4701c31a7 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-options_{id}/postundefined @@ -0,0 +1,11 @@ +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 + } + ] +}' diff --git a/docs/api/admin/code_samples/Shell/shipping-profiles/getundefined b/docs/api/admin/code_samples/Shell/shipping-profiles/getundefined new file mode 100644 index 0000000000..0d5452bd32 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-profiles/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/shipping-profiles' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/shipping-profiles/postundefined b/docs/api/admin/code_samples/Shell/shipping-profiles/postundefined new file mode 100644 index 0000000000..639c2efa96 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-profiles/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/deleteundefined new file mode 100644 index 0000000000..a2e4101fbb --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/shipping-profiles/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/getundefined b/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/getundefined new file mode 100644 index 0000000000..30387b3e43 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/shipping-profiles/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/postundefined b/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/postundefined new file mode 100644 index 0000000000..fba91f5e74 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/shipping-profiles_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/store/getundefined b/docs/api/admin/code_samples/Shell/store/getundefined new file mode 100644 index 0000000000..4e6788bb2b --- /dev/null +++ b/docs/api/admin/code_samples/Shell/store/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/store' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/store/postundefined b/docs/api/admin/code_samples/Shell/store/postundefined new file mode 100644 index 0000000000..dbd827b84e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/store/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/store_currencies_{code}/deleteundefined b/docs/api/admin/code_samples/Shell/store_currencies_{code}/deleteundefined new file mode 100644 index 0000000000..9fcd216704 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/store_currencies_{code}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/store/currencies/eur' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/store_currencies_{code}/postundefined b/docs/api/admin/code_samples/Shell/store_currencies_{code}/postundefined new file mode 100644 index 0000000000..6728f396d6 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/store_currencies_{code}/postundefined @@ -0,0 +1,2 @@ +curl --location --request POST 'https://medusa-url.com/admin/store/currencies/eur' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/store_payment-providers/getundefined b/docs/api/admin/code_samples/Shell/store_payment-providers/getundefined new file mode 100644 index 0000000000..ce1d76a1ba --- /dev/null +++ b/docs/api/admin/code_samples/Shell/store_payment-providers/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/store/payment-providers' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/store_tax-providers/getundefined b/docs/api/admin/code_samples/Shell/store_tax-providers/getundefined new file mode 100644 index 0000000000..994765208e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/store_tax-providers/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/store/tax-providers' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/swaps/getundefined b/docs/api/admin/code_samples/Shell/swaps/getundefined new file mode 100644 index 0000000000..e59841db91 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/swaps/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/swaps' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/swaps_{id}/getundefined b/docs/api/admin/code_samples/Shell/swaps_{id}/getundefined new file mode 100644 index 0000000000..46abeeebd4 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/swaps_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/swaps/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates/getundefined b/docs/api/admin/code_samples/Shell/tax-rates/getundefined new file mode 100644 index 0000000000..c96b101113 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/tax-rates' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates/postundefined b/docs/api/admin/code_samples/Shell/tax-rates/postundefined new file mode 100644 index 0000000000..d137d440b2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates/postundefined @@ -0,0 +1,8 @@ +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}" +}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}/deleteundefined new file mode 100644 index 0000000000..ef79c01b3a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/tax-rates/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}/getundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}/getundefined new file mode 100644 index 0000000000..dbc4c854d4 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/tax-rates/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}/postundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}/postundefined new file mode 100644 index 0000000000..be7f8b3044 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}_product-types_batch/deleteundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}_product-types_batch/deleteundefined new file mode 100644 index 0000000000..5b76f970b2 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}_product-types_batch/deleteundefined @@ -0,0 +1,8 @@ +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}" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}_product-types_batch/postundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}_product-types_batch/postundefined new file mode 100644 index 0000000000..1a9fbf3bd8 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}_product-types_batch/postundefined @@ -0,0 +1,8 @@ +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}" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}_products_batch/deleteundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}_products_batch/deleteundefined new file mode 100644 index 0000000000..94d17024de --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}_products_batch/deleteundefined @@ -0,0 +1,8 @@ +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}" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}_products_batch/postundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}_products_batch/postundefined new file mode 100644 index 0000000000..56a3c7c1d0 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}_products_batch/postundefined @@ -0,0 +1,8 @@ +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}" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}_shipping-options_batch/deleteundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}_shipping-options_batch/deleteundefined new file mode 100644 index 0000000000..da28874e62 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}_shipping-options_batch/deleteundefined @@ -0,0 +1,8 @@ +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}" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/tax-rates_{id}_shipping-options_batch/postundefined b/docs/api/admin/code_samples/Shell/tax-rates_{id}_shipping-options_batch/postundefined new file mode 100644 index 0000000000..9a4832e4b1 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/tax-rates_{id}_shipping-options_batch/postundefined @@ -0,0 +1,8 @@ +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}" + ] +}' diff --git a/docs/api/admin/code_samples/Shell/uploads/postundefined b/docs/api/admin/code_samples/Shell/uploads/postundefined new file mode 100644 index 0000000000..84e6306515 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/uploads/postundefined @@ -0,0 +1,4 @@ +curl --location --request POST 'https://medusa-url.com/admin/uploads' \ +--header 'Authorization: Bearer {api_token}' \ +--header 'Content-Type: image/jpeg' \ +--data-binary '{file_path}' diff --git a/docs/api/admin/code_samples/Shell/users/getundefined b/docs/api/admin/code_samples/Shell/users/getundefined new file mode 100644 index 0000000000..997a504b9a --- /dev/null +++ b/docs/api/admin/code_samples/Shell/users/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/users' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/users/postundefined b/docs/api/admin/code_samples/Shell/users/postundefined new file mode 100644 index 0000000000..ad260e50b9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/users/postundefined @@ -0,0 +1,7 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/users_password-token/postundefined b/docs/api/admin/code_samples/Shell/users_password-token/postundefined new file mode 100644 index 0000000000..ca77eb6531 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/users_password-token/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/users_reset-password/postundefined b/docs/api/admin/code_samples/Shell/users_reset-password/postundefined new file mode 100644 index 0000000000..0da3a193c9 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/users_reset-password/postundefined @@ -0,0 +1,7 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/users_{id}/deleteundefined b/docs/api/admin/code_samples/Shell/users_{id}/deleteundefined new file mode 100644 index 0000000000..64a27ff124 --- /dev/null +++ b/docs/api/admin/code_samples/Shell/users_{id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/admin/users/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/users_{id}/getundefined b/docs/api/admin/code_samples/Shell/users_{id}/getundefined new file mode 100644 index 0000000000..0f9b191ecd --- /dev/null +++ b/docs/api/admin/code_samples/Shell/users_{id}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/users/{id}' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/code_samples/Shell/users_{id}/postundefined b/docs/api/admin/code_samples/Shell/users_{id}/postundefined new file mode 100644 index 0000000000..4d4cc432ba --- /dev/null +++ b/docs/api/admin/code_samples/Shell/users_{id}/postundefined @@ -0,0 +1,6 @@ +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" +}' diff --git a/docs/api/admin/code_samples/Shell/variants/getundefined b/docs/api/admin/code_samples/Shell/variants/getundefined new file mode 100644 index 0000000000..15059a495e --- /dev/null +++ b/docs/api/admin/code_samples/Shell/variants/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/admin/variants' \ +--header 'Authorization: Bearer {api_token}' diff --git a/docs/api/admin/components/examples/database_error.yaml b/docs/api/admin/components/examples/database_error.yaml new file mode 100644 index 0000000000..07f4ce82cb --- /dev/null +++ b/docs/api/admin/components/examples/database_error.yaml @@ -0,0 +1,5 @@ +summary: Database Error +value: + code: api_error + message: An error occured while hashing password + type: database_error diff --git a/docs/api/admin/components/examples/default_error.yaml b/docs/api/admin/components/examples/default_error.yaml new file mode 100644 index 0000000000..b24cde7cd9 --- /dev/null +++ b/docs/api/admin/components/examples/default_error.yaml @@ -0,0 +1,5 @@ +summary: Default Error +value: + code: unknown_error + message: An unknown error occurred. + type: unknown_error diff --git a/docs/api/admin/components/examples/invalid_argument_error.yaml b/docs/api/admin/components/examples/invalid_argument_error.yaml new file mode 100644 index 0000000000..364d93fde8 --- /dev/null +++ b/docs/api/admin/components/examples/invalid_argument_error.yaml @@ -0,0 +1,4 @@ +summary: Invalid Argument Error +value: + message: cart.total must be defined + type: unexpected_state diff --git a/docs/api/admin/components/examples/invalid_data_error.yaml b/docs/api/admin/components/examples/invalid_data_error.yaml new file mode 100644 index 0000000000..62ea2f6f71 --- /dev/null +++ b/docs/api/admin/components/examples/invalid_data_error.yaml @@ -0,0 +1,4 @@ +summary: Invalid Data Error +value: + message: first_name must be a string + type: invalid_data diff --git a/docs/api/admin/components/examples/multiple_errors.yaml b/docs/api/admin/components/examples/multiple_errors.yaml new file mode 100644 index 0000000000..044e062400 --- /dev/null +++ b/docs/api/admin/components/examples/multiple_errors.yaml @@ -0,0 +1,10 @@ +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 diff --git a/docs/api/admin/components/examples/not_allowed_error.yaml b/docs/api/admin/components/examples/not_allowed_error.yaml new file mode 100644 index 0000000000..5388080633 --- /dev/null +++ b/docs/api/admin/components/examples/not_allowed_error.yaml @@ -0,0 +1,4 @@ +summary: Not Allowed Error +value: + message: Discount must be set to dynamic + type: not_allowed diff --git a/docs/api/admin/components/examples/unexpected_state_error.yaml b/docs/api/admin/components/examples/unexpected_state_error.yaml new file mode 100644 index 0000000000..297e630dee --- /dev/null +++ b/docs/api/admin/components/examples/unexpected_state_error.yaml @@ -0,0 +1,4 @@ +summary: Unexpected State Error +value: + message: cart.total must be defined + type: unexpected_state diff --git a/docs/api/admin/components/responses/400_error.yaml b/docs/api/admin/components/responses/400_error.yaml new file mode 100644 index 0000000000..95f25b376b --- /dev/null +++ b/docs/api/admin/components/responses/400_error.yaml @@ -0,0 +1,14 @@ +description: Client Error or Multiple Errors +content: + application/json: + schema: + oneOf: + - $ref: ../schemas/error.yaml + - $ref: ../schemas/multiple_errors.yaml + examples: + not_allowed: + $ref: ../examples/not_allowed_error.yaml + invalid_data: + $ref: ../examples/invalid_data_error.yaml + multiple_errors: + $ref: ../examples/multiple_errors.yaml diff --git a/docs/api/admin/components/responses/500_error.yaml b/docs/api/admin/components/responses/500_error.yaml new file mode 100644 index 0000000000..ecb2e70917 --- /dev/null +++ b/docs/api/admin/components/responses/500_error.yaml @@ -0,0 +1,14 @@ +description: Server Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + examples: + database: + $ref: ../examples/database_error.yaml + unexpected_state: + $ref: ../examples/unexpected_state_error.yaml + invalid_argument: + $ref: ../examples/invalid_argument_error.yaml + default_error: + $ref: ../examples/default_error.yaml diff --git a/docs/api/admin/components/responses/default_error.yaml b/docs/api/admin/components/responses/default_error.yaml new file mode 100644 index 0000000000..b7d6911d9d --- /dev/null +++ b/docs/api/admin/components/responses/default_error.yaml @@ -0,0 +1,9 @@ +description: Default Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + code: unknown_error + message: An unknown error occurred. + type: unknown_error diff --git a/docs/api/admin/components/responses/incorrect_credentials.yaml b/docs/api/admin/components/responses/incorrect_credentials.yaml new file mode 100644 index 0000000000..c1537623ba --- /dev/null +++ b/docs/api/admin/components/responses/incorrect_credentials.yaml @@ -0,0 +1,7 @@ +description: User does not exist or incorrect credentials +content: + text/plain: + schema: + type: string + default: Unauthorized + example: Unauthorized diff --git a/docs/api/admin/components/responses/invalid_request_error.yaml b/docs/api/admin/components/responses/invalid_request_error.yaml new file mode 100644 index 0000000000..4050c5fc89 --- /dev/null +++ b/docs/api/admin/components/responses/invalid_request_error.yaml @@ -0,0 +1,9 @@ +description: Invalid Request Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + code: invalid_request_error + message: Discount with code TEST already exists. + type: duplicate_error diff --git a/docs/api/admin/components/responses/invalid_state_error.yaml b/docs/api/admin/components/responses/invalid_state_error.yaml new file mode 100644 index 0000000000..fbbf916749 --- /dev/null +++ b/docs/api/admin/components/responses/invalid_state_error.yaml @@ -0,0 +1,11 @@ +description: Invalid State Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + code: unknown_error + message: >- + The request conflicted with another request. You may retry the request + with the provided Idempotency-Key. + type: QueryRunnerAlreadyReleasedError diff --git a/docs/api/admin/components/responses/not_found_error.yaml b/docs/api/admin/components/responses/not_found_error.yaml new file mode 100644 index 0000000000..667ae355c0 --- /dev/null +++ b/docs/api/admin/components/responses/not_found_error.yaml @@ -0,0 +1,8 @@ +description: Not Found Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + message: Entity with id 1 was not found + type: not_found diff --git a/docs/api/admin/components/responses/unauthorized.yaml b/docs/api/admin/components/responses/unauthorized.yaml new file mode 100644 index 0000000000..6e59a0886a --- /dev/null +++ b/docs/api/admin/components/responses/unauthorized.yaml @@ -0,0 +1,7 @@ +description: User is not authorized. Must log in first +content: + text/plain: + schema: + type: string + default: Unauthorized + example: Unauthorized diff --git a/docs/api/admin/components/schemas/error.yaml b/docs/api/admin/components/schemas/error.yaml new file mode 100644 index 0000000000..c8baa14163 --- /dev/null +++ b/docs/api/admin/components/schemas/error.yaml @@ -0,0 +1,12 @@ +title: Response Error +x-resourceId: error +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. diff --git a/docs/api/admin/components/schemas/multiple_errors.yaml b/docs/api/admin/components/schemas/multiple_errors.yaml new file mode 100644 index 0000000000..579282df2f --- /dev/null +++ b/docs/api/admin/components/schemas/multiple_errors.yaml @@ -0,0 +1,13 @@ +title: Multiple Errors +x-resourceId: multiple_errors +properties: + errors: + type: array + description: Array of errors + items: + $ref: ./error.yaml + message: + type: string + default: >- + Provided request body contains errors. Please check the data and retry the + request diff --git a/docs/api/admin/openapi.yaml b/docs/api/admin/openapi.yaml index 13603ffba6..63cf486445 100644 --- a/docs/api/admin/openapi.yaml +++ b/docs/api/admin/openapi.yaml @@ -2,9 +2,19 @@ openapi: 3.0.0 info: version: 1.0.0 title: Medusa Admin API - description: >- + 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. + + + license: name: MIT url: https://github.com/medusajs/medusa/blob/master/LICENSE @@ -66,7 +76,7 @@ tags: - name: Product Tag description: Product Tag endpoints that allow handling product tags in Medusa. x-resourceId: product_tag - - name: Product Types + - name: Product Type description: Product Types endpoints that allow handling product types in Medusa. x-resourceId: product_type - name: Product Variant @@ -349,3 +359,144 @@ paths: $ref: paths/users_reset-password.yaml /variants: $ref: paths/variants.yaml +components: + 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 -U + + UPDATE public.user SET api_token='' WHERE + email=''; + + ``` + + + Where: + + - `` is the name of the database schema you use for the Medusa + server. + + - `` is the name of the user that has privileges over the + database schema. + + - `` is the API token you want to associate with the user. + You can use [this tool to generate a random + token](https://randomkeygen.com/). + + - `` 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 alternatively following along with the JS Client request + samples, you must provide the `apiKey` option when creating the Medusa + client: + + + ```js + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3, + 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. diff --git a/docs/api/admin/paths/admin_draft-orders_{id}.yaml b/docs/api/admin/paths/admin_draft-orders_{id}.yaml index 4855247cef..91681f22d8 100644 --- a/docs/api/admin/paths/admin_draft-orders_{id}.yaml +++ b/docs/api/admin/paths/admin_draft-orders_{id}.yaml @@ -54,6 +54,18 @@ post: customer_id: description: The ID of the Customer to associate the Draft Order with. type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/admin_draft-orders_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/admin_draft-orders_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -65,3 +77,15 @@ post: properties: draft_order: $ref: ../components/schemas/draft-order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/apps.yaml b/docs/api/admin/paths/apps.yaml index c29526c571..f4f2501542 100644 --- a/docs/api/admin/paths/apps.yaml +++ b/docs/api/admin/paths/apps.yaml @@ -3,6 +3,14 @@ get: summary: List applications description: Retrieve a list of applications. x-authenticated: true + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/apps/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - App responses: @@ -16,3 +24,15 @@ get: type: array items: $ref: ../components/schemas/OAuth.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/apps_authorizations.yaml b/docs/api/admin/paths/apps_authorizations.yaml index 7d61982e8c..d8ca7f7795 100644 --- a/docs/api/admin/paths/apps_authorizations.yaml +++ b/docs/api/admin/paths/apps_authorizations.yaml @@ -21,6 +21,14 @@ post: code: type: string description: The code for the generated token. + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/apps_authorizations/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - App responses: @@ -32,3 +40,15 @@ post: properties: apps: $ref: ../components/schemas/OAuth.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/auth.yaml b/docs/api/admin/paths/auth.yaml index b49b934669..e7315b4a94 100644 --- a/docs/api/admin/paths/auth.yaml +++ b/docs/api/admin/paths/auth.yaml @@ -19,34 +19,15 @@ post: password: type: string description: The User's password. - tags: - - Auth - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - user: - $ref: ../components/schemas/user.yaml - '401': - description: The user doesn't exist or the credentials are incorrect. -delete: - operationId: DeleteAuth - summary: Delete Session - x-authenticated: true - description: Deletes the current session for the logged in user. - tags: - - Auth - responses: - '200': - description: OK -get: - operationId: GetAuth - summary: Get Session - x-authenticated: true - description: Gets the currently logged in User. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/auth/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/auth/postundefined tags: - Auth responses: @@ -59,4 +40,88 @@ get: user: $ref: ../components/schemas/user.yaml '400': - description: An error occurred. + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/incorrect_credentials.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml +delete: + operationId: DeleteAuth + summary: Delete Session + x-authenticated: true + description: Deletes the current session for the logged in user. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/auth/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/auth/deleteundefined + security: + - api_token: [] + - cookie_auth: [] + tags: + - Auth + responses: + '200': + description: OK + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml +get: + operationId: GetAuth + summary: Get Session + x-authenticated: true + description: Gets the currently logged in User. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/auth/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/auth/getundefined + security: + - api_token: [] + - cookie_auth: [] + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: ../components/schemas/user.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/batch-jobs.yaml b/docs/api/admin/paths/batch-jobs.yaml index 6b660c9a2f..83c55f8e0d 100644 --- a/docs/api/admin/paths/batch-jobs.yaml +++ b/docs/api/admin/paths/batch-jobs.yaml @@ -42,6 +42,18 @@ post: Set a batch job in dry_run mode to get some information on what will be done without applying any modifications. default: false + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/batch-jobs/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/batch-jobs/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Batch Job responses: @@ -53,6 +65,18 @@ post: properties: batch_job: $ref: ../components/schemas/batch_job.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetBatchJobs summary: List Batch Jobs @@ -294,6 +318,18 @@ get: type: string description: filter by dates greater than or equal to this date format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/batch-jobs/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/batch-jobs/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Batch Job responses: @@ -316,3 +352,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/batch-jobs_{id}.yaml b/docs/api/admin/paths/batch-jobs_{id}.yaml index 9d0f4ae7d5..5d67f95057 100644 --- a/docs/api/admin/paths/batch-jobs_{id}.yaml +++ b/docs/api/admin/paths/batch-jobs_{id}.yaml @@ -10,6 +10,18 @@ get: description: The ID of the Batch Job schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/batch-jobs_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/batch-jobs_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Batch Job responses: @@ -21,3 +33,15 @@ get: properties: batch_job: $ref: ../components/schemas/batch_job.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/batch-jobs_{id}_cancel.yaml b/docs/api/admin/paths/batch-jobs_{id}_cancel.yaml index d754a32790..cb3170c72e 100644 --- a/docs/api/admin/paths/batch-jobs_{id}_cancel.yaml +++ b/docs/api/admin/paths/batch-jobs_{id}_cancel.yaml @@ -10,6 +10,18 @@ post: description: The ID of the batch job. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/batch-jobs_{id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/batch-jobs_{id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Batch Job responses: @@ -21,3 +33,15 @@ post: properties: batch_job: $ref: ../components/schemas/batch_job.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/batch-jobs_{id}_confirm.yaml b/docs/api/admin/paths/batch-jobs_{id}_confirm.yaml index dc85edfc0f..63bdbf6475 100644 --- a/docs/api/admin/paths/batch-jobs_{id}_confirm.yaml +++ b/docs/api/admin/paths/batch-jobs_{id}_confirm.yaml @@ -10,6 +10,18 @@ post: description: The ID of the batch job. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/batch-jobs_{id}_confirm/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/batch-jobs_{id}_confirm/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Batch Job responses: @@ -21,3 +33,15 @@ post: properties: batch_job: $ref: ../components/schemas/batch_job.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/collections.yaml b/docs/api/admin/paths/collections.yaml index 9fcc46fd19..629a5292a1 100644 --- a/docs/api/admin/paths/collections.yaml +++ b/docs/api/admin/paths/collections.yaml @@ -23,6 +23,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/collections/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Collection responses: @@ -34,6 +46,18 @@ post: properties: collection: $ref: ../components/schemas/product_collection.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetCollections summary: List Product Collections @@ -133,6 +157,18 @@ get: type: string description: filter by dates greater than or equal to this date format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/collections/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Collection responses: @@ -155,3 +191,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/collections_{id}.yaml b/docs/api/admin/paths/collections_{id}.yaml index d949bc5a74..4ea826157b 100644 --- a/docs/api/admin/paths/collections_{id}.yaml +++ b/docs/api/admin/paths/collections_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Collection. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/collections_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Collection responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether the collection was deleted successfully or not. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetCollectionsCollection summary: Retrieve a Product Collection @@ -42,6 +66,18 @@ get: description: The ID of the Product Collection schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/collections_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Collection responses: @@ -53,6 +89,18 @@ get: properties: collection: $ref: ../components/schemas/product_collection.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCollectionsCollection summary: Update a Product Collection @@ -83,6 +131,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/collections_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Collection responses: @@ -94,3 +154,15 @@ post: properties: collection: $ref: ../components/schemas/product_collection.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/collections_{id}_products_batch.yaml b/docs/api/admin/paths/collections_{id}_products_batch.yaml index 2d02589d38..8d54a508ce 100644 --- a/docs/api/admin/paths/collections_{id}_products_batch.yaml +++ b/docs/api/admin/paths/collections_{id}_products_batch.yaml @@ -23,6 +23,14 @@ post: items: description: The ID of a Product to add to the Product Collection. type: string + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections_{id}_products_batch/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Collection responses: @@ -34,6 +42,18 @@ post: properties: collection: $ref: ../components/schemas/product_collection.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteProductsFromCollection summary: Removes products associated with a Product Collection @@ -59,6 +79,14 @@ delete: items: description: The ID of a Product to add to the Product Collection. type: string + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections_{id}_products_batch/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Collection responses: @@ -81,3 +109,15 @@ delete: items: description: The ID of a Product to add to the Product Collection. type: string + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/customer-groups.yaml b/docs/api/admin/paths/customer-groups.yaml index 6f0f1c2a57..1c7d697369 100644 --- a/docs/api/admin/paths/customer-groups.yaml +++ b/docs/api/admin/paths/customer-groups.yaml @@ -4,6 +4,18 @@ post: description: Creates a CustomerGroup. x-authenticated: true parameters: [] + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customer-groups/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customer-groups/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -15,6 +27,18 @@ post: properties: customer_group: $ref: ../components/schemas/customer_group.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: @@ -146,6 +170,18 @@ get: groups of the result. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customer-groups/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customer-groups/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -168,3 +204,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/customer-groups_{id}.yaml b/docs/api/admin/paths/customer-groups_{id}.yaml index d0ea8b72a2..f0429042ad 100644 --- a/docs/api/admin/paths/customer-groups_{id}.yaml +++ b/docs/api/admin/paths/customer-groups_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Customer Group schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customer-groups_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customer-groups_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether the customer group was deleted successfully or not. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetCustomerGroupsGroup summary: Retrieve a CustomerGroup @@ -52,6 +76,18 @@ get: description: (Comma separated) Which fields should be included in the customer group. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customer-groups_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customer-groups_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -63,6 +99,18 @@ get: properties: customer_group: $ref: ../components/schemas/customer_group.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCustomerGroupsGroup summary: Update a CustomerGroup @@ -86,6 +134,18 @@ post: metadata: description: Metadata for the customer. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customer-groups_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customer-groups_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -97,3 +157,15 @@ post: properties: customer_group: $ref: ../components/schemas/customer_group.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/customer-groups_{id}_customers.yaml b/docs/api/admin/paths/customer-groups_{id}_customers.yaml index 93cf62793a..73bc73eeec 100644 --- a/docs/api/admin/paths/customer-groups_{id}_customers.yaml +++ b/docs/api/admin/paths/customer-groups_{id}_customers.yaml @@ -10,6 +10,18 @@ get: description: The ID of the customer group. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customer-groups_{id}_customers/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customer-groups_{id}_customers/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -32,3 +44,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/customer-groups_{id}_customers_batch.yaml b/docs/api/admin/paths/customer-groups_{id}_customers_batch.yaml index c139980b1f..a7b82fa4d4 100644 --- a/docs/api/admin/paths/customer-groups_{id}_customers_batch.yaml +++ b/docs/api/admin/paths/customer-groups_{id}_customers_batch.yaml @@ -27,6 +27,20 @@ post: id: description: ID of the customer type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/customer-groups_{id}_customers_batch/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/customer-groups_{id}_customers_batch/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -38,6 +52,18 @@ post: properties: customer_group: $ref: ../components/schemas/customer_group.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteCustomerGroupsGroupCustomerBatch summary: 'Remove a list of customers from a customer group ' @@ -67,6 +93,20 @@ delete: id: description: ID of the customer type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/customer-groups_{id}_customers_batch/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/customer-groups_{id}_customers_batch/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer Group responses: @@ -78,3 +118,15 @@ delete: properties: customer_group: $ref: ../components/schemas/customer_group.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/customers.yaml b/docs/api/admin/paths/customers.yaml index a72518f26b..f1b84cdc12 100644 --- a/docs/api/admin/paths/customers.yaml +++ b/docs/api/admin/paths/customers.yaml @@ -37,6 +37,18 @@ post: type: object tags: - Customer + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers/postundefined + security: + - api_token: [] + - cookie_auth: [] responses: '201': description: OK @@ -46,6 +58,18 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetCustomers summary: List Customers @@ -74,6 +98,18 @@ get: description: a search term to search email, first_name, and last_name. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer responses: @@ -96,3 +132,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/customers_{id}.yaml b/docs/api/admin/paths/customers_{id}.yaml index 22b9979e92..1c5a77d292 100644 --- a/docs/api/admin/paths/customers_{id}.yaml +++ b/docs/api/admin/paths/customers_{id}.yaml @@ -20,6 +20,18 @@ get: description: (Comma separated) Which fields should be included in the customer. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer responses: @@ -31,6 +43,18 @@ get: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCustomersCustomer summary: Update a Customer @@ -90,6 +114,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Customer responses: @@ -101,3 +137,15 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/discounts.yaml b/docs/api/admin/paths/discounts.yaml index 419c5b4bb5..7736ff86a0 100644 --- a/docs/api/admin/paths/discounts.yaml +++ b/docs/api/admin/paths/discounts.yaml @@ -153,6 +153,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/discounts/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -164,6 +176,18 @@ post: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetDiscounts summary: List Discounts @@ -226,6 +250,18 @@ get: description: Comma separated list of relations to include in the results. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/discounts/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -248,3 +284,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/discounts_code_{code}.yaml b/docs/api/admin/paths/discounts_code_{code}.yaml index eea7f4d09e..9061a5c0fd 100644 --- a/docs/api/admin/paths/discounts_code_{code}.yaml +++ b/docs/api/admin/paths/discounts_code_{code}.yaml @@ -20,6 +20,18 @@ get: description: Comma separated list of fields to include in the results. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/discounts_code_{code}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts_code_{code}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -31,3 +43,15 @@ get: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/discounts_{discount_id}_conditions.yaml b/docs/api/admin/paths/discounts_{discount_id}_conditions.yaml index ba7aff9742..9085163be9 100644 --- a/docs/api/admin/paths/discounts_{discount_id}_conditions.yaml +++ b/docs/api/admin/paths/discounts_{discount_id}_conditions.yaml @@ -73,6 +73,19 @@ post: customer groups. items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/discounts_{discount_id}_conditions/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts_{discount_id}_conditions/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount Condition responses: @@ -84,3 +97,15 @@ post: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/discounts_{discount_id}_conditions_{condition_id}.yaml b/docs/api/admin/paths/discounts_{discount_id}_conditions_{condition_id}.yaml index 405a7a3658..4089c933dd 100644 --- a/docs/api/admin/paths/discounts_{discount_id}_conditions_{condition_id}.yaml +++ b/docs/api/admin/paths/discounts_{discount_id}_conditions_{condition_id}.yaml @@ -26,6 +26,20 @@ delete: description: Comma separated list of fields to include in the results. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount Condition responses: @@ -51,9 +65,22 @@ delete: discount: description: The Discount to which the condition used to belong $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetDiscountsDiscountConditionsCondition summary: Gets a DiscountCondition + description: Gets a DiscountCondition x-authenticated: true parameters: - in: path @@ -78,7 +105,20 @@ get: description: Comma separated list of fields to include in the results. schema: type: string - description: Gets a DiscountCondition + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/getundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount Condition responses: @@ -90,6 +130,18 @@ get: properties: discount_condition: $ref: ../components/schemas/discount_condition.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostDiscountsDiscountConditionsCondition summary: Update a DiscountCondition @@ -163,6 +215,20 @@ post: customer groups. items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -174,3 +240,15 @@ post: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/discounts_{id}.yaml b/docs/api/admin/paths/discounts_{id}.yaml index d975584355..5cd549b52a 100644 --- a/docs/api/admin/paths/discounts_{id}.yaml +++ b/docs/api/admin/paths/discounts_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Discount schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/discounts_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether the discount was deleted successfully or not. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetDiscountsDiscount summary: Retrieve a Discount @@ -52,6 +76,18 @@ get: description: Comma separated list of fields to include in the results. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/discounts_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -63,6 +99,18 @@ get: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostDiscountsDiscount summary: Update a Discount @@ -208,6 +256,18 @@ post: metadata: description: An object containing metadata of the discount type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/discounts_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -219,3 +279,15 @@ post: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/discounts_{id}_dynamic-codes.yaml b/docs/api/admin/paths/discounts_{id}_dynamic-codes.yaml index 9d88c80442..1a7e0c0cde 100644 --- a/docs/api/admin/paths/discounts_{id}_dynamic-codes.yaml +++ b/docs/api/admin/paths/discounts_{id}_dynamic-codes.yaml @@ -12,6 +12,18 @@ post: description: The ID of the Discount to create the dynamic code from." schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/discounts_{id}_dynamic-codes/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts_{id}_dynamic-codes/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -23,6 +35,18 @@ post: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: diff --git a/docs/api/admin/paths/discounts_{id}_dynamic-codes_{code}.yaml b/docs/api/admin/paths/discounts_{id}_dynamic-codes_{code}.yaml index 7b7eaaf5ff..2a31840467 100644 --- a/docs/api/admin/paths/discounts_{id}_dynamic-codes_{code}.yaml +++ b/docs/api/admin/paths/discounts_{id}_dynamic-codes_{code}.yaml @@ -16,6 +16,20 @@ delete: description: The ID of the Discount schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/discounts_{id}_dynamic-codes_{code}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/discounts_{id}_dynamic-codes_{code}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -27,3 +41,15 @@ delete: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/discounts_{id}_regions_{region_id}.yaml b/docs/api/admin/paths/discounts_{id}_regions_{region_id}.yaml index 20d08f82be..95b22e42df 100644 --- a/docs/api/admin/paths/discounts_{id}_regions_{region_id}.yaml +++ b/docs/api/admin/paths/discounts_{id}_regions_{region_id}.yaml @@ -16,6 +16,19 @@ post: description: The ID of the Region. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/discounts_{id}_regions_{region_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/discounts_{id}_regions_{region_id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -27,6 +40,18 @@ post: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteDiscountsDiscountRegionsRegion summary: Remove Region availability @@ -45,6 +70,20 @@ delete: description: The ID of the Region. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/discounts_{id}_regions_{region_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/discounts_{id}_regions_{region_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Discount responses: @@ -56,3 +95,15 @@ delete: properties: discount: $ref: ../components/schemas/discount.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/draft-orders.yaml b/docs/api/admin/paths/draft-orders.yaml index 6248fa51be..03a64085ec 100644 --- a/docs/api/admin/paths/draft-orders.yaml +++ b/docs/api/admin/paths/draft-orders.yaml @@ -102,6 +102,18 @@ post: The optional key-value map with additional details about the Draft Order. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/draft-orders/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/draft-orders/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -113,6 +125,18 @@ post: properties: draft_order: $ref: ../components/schemas/draft-order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetDraftOrders summary: List Draft Orders @@ -138,6 +162,18 @@ get: display IDs of draft orders schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/draft-orders/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/draft-orders/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -160,3 +196,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/draft-orders_{id}.yaml b/docs/api/admin/paths/draft-orders_{id}.yaml index ba4d184535..525d1df97a 100644 --- a/docs/api/admin/paths/draft-orders_{id}.yaml +++ b/docs/api/admin/paths/draft-orders_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Draft Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/draft-orders_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/draft-orders_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether the draft order was deleted successfully or not. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetDraftOrdersDraftOrder summary: Retrieve a Draft Order @@ -42,6 +66,18 @@ get: description: The ID of the Draft Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/draft-orders_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/draft-orders_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -53,3 +89,15 @@ get: properties: draft_order: $ref: ../components/schemas/draft-order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/draft-orders_{id}_line-items.yaml b/docs/api/admin/paths/draft-orders_{id}_line-items.yaml index c148eb193f..29dd28e4e0 100644 --- a/docs/api/admin/paths/draft-orders_{id}_line-items.yaml +++ b/docs/api/admin/paths/draft-orders_{id}_line-items.yaml @@ -35,6 +35,18 @@ post: The optional key-value map with additional details about the Line Item. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/draft-orders_{id}_line-items/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/draft-orders_{id}_line-items/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -46,3 +58,15 @@ post: properties: draft_order: $ref: ../components/schemas/draft-order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/draft-orders_{id}_line-items_{line_id}.yaml b/docs/api/admin/paths/draft-orders_{id}_line-items_{line_id}.yaml index d9910fda20..200a1e210a 100644 --- a/docs/api/admin/paths/draft-orders_{id}_line-items_{line_id}.yaml +++ b/docs/api/admin/paths/draft-orders_{id}_line-items_{line_id}.yaml @@ -16,6 +16,20 @@ delete: description: The ID of the Draft Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/draft-orders_{id}_line-items_{line_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -27,6 +41,18 @@ delete: properties: draft_order: $ref: ../components/schemas/draft-order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostDraftOrdersDraftOrderLineItemsItem summary: Update a Line Item for a Draft Order @@ -64,6 +90,20 @@ post: The optional key-value map with additional details about the Line Item. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/draft-orders_{id}_line-items_{line_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/draft-orders_{id}_line-items_{line_id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -75,3 +115,15 @@ post: properties: draft_order: $ref: ../components/schemas/draft-order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/draft-orders_{id}_pay.yaml b/docs/api/admin/paths/draft-orders_{id}_pay.yaml index 86e17e1c26..a1a2780a3c 100644 --- a/docs/api/admin/paths/draft-orders_{id}_pay.yaml +++ b/docs/api/admin/paths/draft-orders_{id}_pay.yaml @@ -10,6 +10,18 @@ post: description: The Draft Order id. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/draft-orders_{id}_pay/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/draft-orders_{id}_pay/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Draft Order responses: @@ -21,3 +33,15 @@ post: properties: order: $ref: ../components/schemas/draft-order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/gift-cards.yaml b/docs/api/admin/paths/gift-cards.yaml index cc8188b39d..57a3bd6bd5 100644 --- a/docs/api/admin/paths/gift-cards.yaml +++ b/docs/api/admin/paths/gift-cards.yaml @@ -32,6 +32,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/gift-cards/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/gift-cards/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Gift Card responses: @@ -43,6 +55,18 @@ post: properties: gift_card: $ref: ../components/schemas/gift_card.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetGiftCards summary: List Gift Cards @@ -66,6 +90,18 @@ get: description: a search term to search by code or display ID schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/gift-cards/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/gift-cards/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Gift Card responses: @@ -88,3 +124,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/gift-cards_{id}.yaml b/docs/api/admin/paths/gift-cards_{id}.yaml index 6d0b761c79..3e8f37e7d8 100644 --- a/docs/api/admin/paths/gift-cards_{id}.yaml +++ b/docs/api/admin/paths/gift-cards_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Gift Card to delete. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/gift-cards_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/gift-cards_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Gift Card responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether the gift card was deleted successfully or not. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetGiftCardsGiftCard summary: Retrieve a Gift Card @@ -42,6 +66,18 @@ get: description: The ID of the Gift Card. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/gift-cards_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/gift-cards_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Gift Card responses: @@ -53,6 +89,18 @@ get: properties: gift_card: $ref: ../components/schemas/gift_card.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostGiftCardsGiftCard summary: Update a Gift Card @@ -92,6 +140,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/gift-cards_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/gift-cards_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Gift Card responses: @@ -103,3 +163,15 @@ post: properties: gift_card: $ref: ../components/schemas/gift_card.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/invites.yaml b/docs/api/admin/paths/invites.yaml index 85b31b2ae2..b8430b1770 100644 --- a/docs/api/admin/paths/invites.yaml +++ b/docs/api/admin/paths/invites.yaml @@ -22,16 +22,52 @@ post: - admin - member - developer + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/invites/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/invites/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Invite responses: '200': description: OK + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetInvites summary: Lists all Invites description: Lists all Invites x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/invites/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/invites/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Invite responses: @@ -45,3 +81,15 @@ get: type: array items: $ref: ../components/schemas/invite.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/invites_accept.yaml b/docs/api/admin/paths/invites_accept.yaml index 35e7f50f1d..96aed875ed 100644 --- a/docs/api/admin/paths/invites_accept.yaml +++ b/docs/api/admin/paths/invites_accept.yaml @@ -31,8 +31,32 @@ post: description: The desired password for the User type: string format: password + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/invites_accept/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/invites_accept/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Invite responses: '200': description: OK + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/invites_{invite_id}.yaml b/docs/api/admin/paths/invites_{invite_id}.yaml index 4724f1dfc0..a94acd41ca 100644 --- a/docs/api/admin/paths/invites_{invite_id}.yaml +++ b/docs/api/admin/paths/invites_{invite_id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Invite schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/invites_{invite_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/invites_{invite_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Invite responses: @@ -30,3 +42,15 @@ delete: type: boolean description: Whether or not the Invite was deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/invites_{invite_id}_resend.yaml b/docs/api/admin/paths/invites_{invite_id}_resend.yaml index 6c1f0662a2..e3faf7e26e 100644 --- a/docs/api/admin/paths/invites_{invite_id}_resend.yaml +++ b/docs/api/admin/paths/invites_{invite_id}_resend.yaml @@ -10,8 +10,32 @@ post: description: The ID of the Invite schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/invites_{invite_id}_resend/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/invites_{invite_id}_resend/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Invite responses: '200': description: OK + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/notes.yaml b/docs/api/admin/paths/notes.yaml index 15e516465b..9e6a5a63d1 100644 --- a/docs/api/admin/paths/notes.yaml +++ b/docs/api/admin/paths/notes.yaml @@ -21,6 +21,18 @@ post: value: type: string description: The content of the Note to create. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/notes/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/notes/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Note responses: @@ -32,6 +44,18 @@ post: properties: note: $ref: ../components/schemas/note.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetNotes summary: List Notes @@ -55,6 +79,18 @@ get: description: The ID which the notes belongs to schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/notes/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/notes/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Note responses: @@ -77,3 +113,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/notes_{id}.yaml b/docs/api/admin/paths/notes_{id}.yaml index 24f0700f3c..dc68c3ff2b 100644 --- a/docs/api/admin/paths/notes_{id}.yaml +++ b/docs/api/admin/paths/notes_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Note to delete. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/notes_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/notes_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Note responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the Note was deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetNotesNote summary: Get Note @@ -42,6 +66,18 @@ get: description: The ID of the note to retrieve. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/notes_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/notes_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Note responses: @@ -53,6 +89,18 @@ get: properties: note: $ref: ../components/schemas/note.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostNotesNote summary: Updates a Note @@ -75,6 +123,18 @@ post: value: type: string description: The updated description of the Note. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/notes_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/notes_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Note responses: @@ -86,3 +146,15 @@ post: properties: note: $ref: ../components/schemas/note.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/notifications.yaml b/docs/api/admin/paths/notifications.yaml index 9aa2ca712f..222f094118 100644 --- a/docs/api/admin/paths/notifications.yaml +++ b/docs/api/admin/paths/notifications.yaml @@ -57,6 +57,18 @@ get: notifications or not schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/notifications/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/notifications/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Notification responses: @@ -70,3 +82,15 @@ get: type: array items: $ref: ../components/schemas/notification.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/notifications_{id}_resend.yaml b/docs/api/admin/paths/notifications_{id}_resend.yaml index 72f58d9fad..5f01ec27a8 100644 --- a/docs/api/admin/paths/notifications_{id}_resend.yaml +++ b/docs/api/admin/paths/notifications_{id}_resend.yaml @@ -22,6 +22,18 @@ post: A new address or user identifier that the Notification should be sent to type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/notifications_{id}_resend/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/notifications_{id}_resend/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Notification responses: @@ -33,3 +45,15 @@ post: properties: notification: $ref: ../components/schemas/notification.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/order_{id}_claims.yaml b/docs/api/admin/paths/order_{id}_claims.yaml index 3d27b2d2f5..b79ed91b77 100644 --- a/docs/api/admin/paths/order_{id}_claims.yaml +++ b/docs/api/admin/paths/order_{id}_claims.yaml @@ -131,6 +131,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/order_{id}_claims/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/order_{id}_claims/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Claim responses: @@ -142,3 +154,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml b/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml index 8e9a412acd..4758acdbca 100644 --- a/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml +++ b/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml @@ -107,6 +107,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/order_{id}_claims_{claim_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/order_{id}_claims_{claim_id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Claim responses: @@ -118,3 +130,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/order_{id}_swaps.yaml b/docs/api/admin/paths/order_{id}_swaps.yaml index 85a0f948b1..804e1246e6 100644 --- a/docs/api/admin/paths/order_{id}_swaps.yaml +++ b/docs/api/admin/paths/order_{id}_swaps.yaml @@ -94,6 +94,18 @@ post: description: If true, swaps can be completed with items out of stock type: boolean default: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/order_{id}_swaps/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/order_{id}_swaps/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Swap responses: @@ -105,3 +117,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders.yaml b/docs/api/admin/paths/orders.yaml index da9e4f81b9..ac44f54eac 100644 --- a/docs/api/admin/paths/orders.yaml +++ b/docs/api/admin/paths/orders.yaml @@ -217,6 +217,18 @@ get: result. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -239,3 +251,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}.yaml b/docs/api/admin/paths/orders_{id}.yaml index 522232cd00..c7aa4edcfa 100644 --- a/docs/api/admin/paths/orders_{id}.yaml +++ b/docs/api/admin/paths/orders_{id}.yaml @@ -10,6 +10,18 @@ get: description: The ID of the Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -21,6 +33,18 @@ get: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostOrdersOrder summary: Update an order @@ -101,6 +125,18 @@ post: A flag to indicate if no notifications should be emitted related to the updated order. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -112,3 +148,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_archive.yaml b/docs/api/admin/paths/orders_{id}_archive.yaml index 7e76e76b62..137390fa9e 100644 --- a/docs/api/admin/paths/orders_{id}_archive.yaml +++ b/docs/api/admin/paths/orders_{id}_archive.yaml @@ -10,6 +10,18 @@ post: description: The ID of the Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_archive/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_archive/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -21,3 +33,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_cancel.yaml index eba6094b48..9ea8b6874f 100644 --- a/docs/api/admin/paths/orders_{id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_cancel.yaml @@ -13,6 +13,18 @@ post: description: The ID of the Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -24,3 +36,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_capture.yaml b/docs/api/admin/paths/orders_{id}_capture.yaml index 606f7ec1fa..aeb203798a 100644 --- a/docs/api/admin/paths/orders_{id}_capture.yaml +++ b/docs/api/admin/paths/orders_{id}_capture.yaml @@ -10,6 +10,18 @@ post: description: The ID of the Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_capture/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_capture/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -21,3 +33,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml index f20534fce9..c3b17efbdc 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml @@ -16,6 +16,20 @@ post: description: The ID of the Claim. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_claims_{claim_id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_claims_{claim_id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Claim responses: @@ -27,3 +41,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml index cda549a877..762f397efd 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml @@ -31,6 +31,20 @@ post: If set to true no notification will be send related to this Claim. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Fulfillment responses: @@ -42,3 +56,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml index 55c62e37fe..5407441074 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -22,6 +22,20 @@ post: description: The ID of the Fulfillment. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Fulfillment responses: @@ -33,3 +47,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml index 842f6274e5..0f9956d11b 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml @@ -31,6 +31,20 @@ post: type: array items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_claims_{claim_id}_shipments/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_claims_{claim_id}_shipments/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Claim responses: @@ -42,3 +56,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_complete.yaml b/docs/api/admin/paths/orders_{id}_complete.yaml index 70d77a6e26..20e28f2977 100644 --- a/docs/api/admin/paths/orders_{id}_complete.yaml +++ b/docs/api/admin/paths/orders_{id}_complete.yaml @@ -10,6 +10,18 @@ post: description: The ID of the Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_complete/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_complete/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -21,3 +33,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_fulfillment.yaml b/docs/api/admin/paths/orders_{id}_fulfillment.yaml index 583f527ead..78e29e7bbd 100644 --- a/docs/api/admin/paths/orders_{id}_fulfillment.yaml +++ b/docs/api/admin/paths/orders_{id}_fulfillment.yaml @@ -43,6 +43,18 @@ post: An optional set of key-value pairs to hold additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_fulfillment/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_fulfillment/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Fulfillment responses: @@ -54,3 +66,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml index 59f192d43c..3143eaf4e5 100644 --- a/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -16,6 +16,20 @@ post: description: The ID of the Fulfillment schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_fulfillments_{fulfillment_id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Fulfillment responses: @@ -27,3 +41,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_refund.yaml b/docs/api/admin/paths/orders_{id}_refund.yaml index 5e6f41da7d..36123185ee 100644 --- a/docs/api/admin/paths/orders_{id}_refund.yaml +++ b/docs/api/admin/paths/orders_{id}_refund.yaml @@ -32,6 +32,18 @@ post: If set to true no notification will be send related to this Refund. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_refund/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_refund/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -43,3 +55,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_return.yaml b/docs/api/admin/paths/orders_{id}_return.yaml index 5264c4a659..1ba5cc3679 100644 --- a/docs/api/admin/paths/orders_{id}_return.yaml +++ b/docs/api/admin/paths/orders_{id}_return.yaml @@ -68,6 +68,18 @@ post: refund: description: The amount to refund. type: integer + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_return/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_return/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return - Order @@ -80,3 +92,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_shipment.yaml b/docs/api/admin/paths/orders_{id}_shipment.yaml index a9b3dfdc00..90765fd1d3 100644 --- a/docs/api/admin/paths/orders_{id}_shipment.yaml +++ b/docs/api/admin/paths/orders_{id}_shipment.yaml @@ -30,6 +30,18 @@ post: If set to true no notification will be send related to this Shipment. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_shipment/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_shipment/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -41,3 +53,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_shipping-methods.yaml b/docs/api/admin/paths/orders_{id}_shipping-methods.yaml index dbed77554a..9cb4847881 100644 --- a/docs/api/admin/paths/orders_{id}_shipping-methods.yaml +++ b/docs/api/admin/paths/orders_{id}_shipping-methods.yaml @@ -12,6 +12,18 @@ post: description: The ID of the Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}_shipping-methods/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_shipping-methods/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Order responses: @@ -23,6 +35,18 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml index dd1dc6425a..811f4aab28 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml @@ -16,6 +16,19 @@ post: description: The ID of the Swap. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_swaps_{swap_id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}_swaps_{swap_id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Swap responses: @@ -27,3 +40,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml index e8ee04bebc..a5d4ed2671 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml @@ -31,6 +31,20 @@ post: If set to true no notification will be send related to this Claim. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Fulfillment responses: @@ -42,3 +56,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml index 8a7bf82d9b..9a20d8ae56 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -22,6 +22,20 @@ post: description: The ID of the Fulfillment. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Fulfillment responses: @@ -33,3 +47,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml index 35987dcfdd..2dc1944f7b 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml @@ -19,6 +19,20 @@ post: description: The ID of the Swap. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_swaps_{swap_id}_process-payment/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_swaps_{swap_id}_process-payment/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Swap responses: @@ -30,3 +44,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml index 3b6e8b7d82..b78cd67ee3 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml @@ -36,6 +36,20 @@ post: If set to true no notification will be send related to this Claim. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/orders_{id}_swaps_{swap_id}_shipments/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/orders_{id}_swaps_{swap_id}_shipments/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Swap responses: @@ -47,3 +61,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/price-lists.yaml b/docs/api/admin/paths/price-lists.yaml index 291cd17026..b5a22674ff 100644 --- a/docs/api/admin/paths/price-lists.yaml +++ b/docs/api/admin/paths/price-lists.yaml @@ -82,6 +82,18 @@ post: id: description: The ID of a customer group type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/price-lists/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -93,6 +105,18 @@ post: properties: price_list: $ref: ../components/schemas/price_list.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetPriceLists summary: List Price Lists @@ -239,6 +263,18 @@ get: type: string description: filter by dates greater than or equal to this date format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/price-lists/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -261,3 +297,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/price-lists_{id}.yaml b/docs/api/admin/paths/price-lists_{id}.yaml index 7dbabaccfe..f35ea0c52c 100644 --- a/docs/api/admin/paths/price-lists_{id}.yaml +++ b/docs/api/admin/paths/price-lists_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Price List to delete. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/price-lists_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetPriceListsPriceList summary: Retrieve a Price List @@ -42,6 +66,18 @@ get: description: The ID of the Price List. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/price-lists_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -53,6 +89,18 @@ get: properties: price_list: $ref: ../components/schemas/price_list.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostPriceListsPriceListPriceList summary: Update a Price List @@ -142,6 +190,18 @@ post: id: description: The ID of a customer group type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/price-lists_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -153,3 +213,15 @@ post: properties: price_list: $ref: ../components/schemas/price_list.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/price-lists_{id}_prices_batch.yaml b/docs/api/admin/paths/price-lists_{id}_prices_batch.yaml index c3b2707b6c..3b8f543166 100644 --- a/docs/api/admin/paths/price-lists_{id}_prices_batch.yaml +++ b/docs/api/admin/paths/price-lists_{id}_prices_batch.yaml @@ -56,6 +56,18 @@ post: If true the prices will replace all existing prices associated with the Price List. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/price-lists_{id}_prices_batch/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists_{id}_prices_batch/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -67,6 +79,18 @@ post: properties: price_list: $ref: ../components/schemas/price_list.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeletePriceListsPriceListPricesBatch summary: Batch delete prices that belong to a Price List @@ -91,6 +115,19 @@ delete: type: array items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/price-lists_{id}_prices_batch/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists_{id}_prices_batch/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -113,3 +150,15 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/price-lists_{id}_products.yaml b/docs/api/admin/paths/price-lists_{id}_products.yaml index e22646befc..2c049fbd12 100644 --- a/docs/api/admin/paths/price-lists_{id}_products.yaml +++ b/docs/api/admin/paths/price-lists_{id}_products.yaml @@ -176,6 +176,18 @@ get: result. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/price-lists_{id}_products/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/price-lists_{id}_products/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -198,3 +210,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/price-lists_{id}_products_{product_id}_prices.yaml b/docs/api/admin/paths/price-lists_{id}_products_{product_id}_prices.yaml index f75ca0179d..a2a1141c49 100644 --- a/docs/api/admin/paths/price-lists_{id}_products_{product_id}_prices.yaml +++ b/docs/api/admin/paths/price-lists_{id}_products_{product_id}_prices.yaml @@ -18,6 +18,20 @@ delete: description: The ID of the product from which the money amount will be deleted. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/price-lists_{id}_products_{product_id}_prices/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/price-lists_{id}_products_{product_id}_prices/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -40,3 +54,15 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/price-lists_{id}_variants_{variant_id}_prices.yaml b/docs/api/admin/paths/price-lists_{id}_variants_{variant_id}_prices.yaml index 57c7b119cf..dbed87fa68 100644 --- a/docs/api/admin/paths/price-lists_{id}_variants_{variant_id}_prices.yaml +++ b/docs/api/admin/paths/price-lists_{id}_variants_{variant_id}_prices.yaml @@ -18,6 +18,20 @@ delete: description: The ID of the variant from which the money amount will be deleted. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/price-lists_{id}_variants_{variant_id}_prices/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/price-lists_{id}_variants_{variant_id}_prices/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Price List responses: @@ -40,3 +54,15 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/product-tags.yaml b/docs/api/admin/paths/product-tags.yaml index 5aa1685ac2..8b68dfdc37 100644 --- a/docs/api/admin/paths/product-tags.yaml +++ b/docs/api/admin/paths/product-tags.yaml @@ -88,6 +88,18 @@ get: type: string description: filter by dates greater than or equal to this date format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/product-tags/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/product-tags/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product Tag responses: @@ -108,3 +120,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/product-types.yaml b/docs/api/admin/paths/product-types.yaml index 6c412a776d..965fcf34e0 100644 --- a/docs/api/admin/paths/product-types.yaml +++ b/docs/api/admin/paths/product-types.yaml @@ -88,6 +88,18 @@ get: type: string description: filter by dates greater than or equal to this date format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/product-types/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/product-types/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product Type responses: @@ -108,3 +120,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products.yaml b/docs/api/admin/paths/products.yaml index 42a4488412..cb078d6f13 100644 --- a/docs/api/admin/paths/products.yaml +++ b/docs/api/admin/paths/products.yaml @@ -241,6 +241,18 @@ post: metadata: description: An optional set of key-value pairs with additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -252,6 +264,18 @@ post: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetProducts summary: List Product @@ -445,6 +469,18 @@ get: result. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -467,3 +503,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_tag-usage.yaml b/docs/api/admin/paths/products_tag-usage.yaml index 20910f398a..6340933e6d 100644 --- a/docs/api/admin/paths/products_tag-usage.yaml +++ b/docs/api/admin/paths/products_tag-usage.yaml @@ -3,6 +3,18 @@ get: summary: List Product Tags Usage Number description: Retrieves a list of Product Tags with how many times each is used. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_tag-usage/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_tag-usage/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product Tag responses: @@ -25,3 +37,15 @@ get: value: description: The value of the tag. type: string + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_types.yaml b/docs/api/admin/paths/products_types.yaml index c8bf32459c..f1cfcefb71 100644 --- a/docs/api/admin/paths/products_types.yaml +++ b/docs/api/admin/paths/products_types.yaml @@ -3,6 +3,18 @@ get: summary: List Product Types description: Retrieves a list of Product Types. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_types/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_types/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -16,3 +28,15 @@ get: type: array items: $ref: ../components/schemas/product_type.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_{id}.yaml b/docs/api/admin/paths/products_{id}.yaml index 540f1ddcc6..d83c4aa536 100644 --- a/docs/api/admin/paths/products_{id}.yaml +++ b/docs/api/admin/paths/products_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Product. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetProductsProduct summary: Retrieve a Product @@ -42,6 +66,18 @@ get: description: The ID of the Product. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -53,6 +89,18 @@ get: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostProductsProduct summary: Update a Product @@ -284,6 +332,18 @@ post: metadata: description: An optional set of key-value pairs with additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -295,3 +355,15 @@ post: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_{id}_metadata.yaml b/docs/api/admin/paths/products_{id}_metadata.yaml index 1af710764c..19d99cbb4c 100644 --- a/docs/api/admin/paths/products_{id}_metadata.yaml +++ b/docs/api/admin/paths/products_{id}_metadata.yaml @@ -24,6 +24,18 @@ post: value: description: The metadata value type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_{id}_metadata/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}_metadata/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -35,3 +47,15 @@ post: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_{id}_options.yaml b/docs/api/admin/paths/products_{id}_options.yaml index 5624796830..8d0b52ad5e 100644 --- a/docs/api/admin/paths/products_{id}_options.yaml +++ b/docs/api/admin/paths/products_{id}_options.yaml @@ -20,6 +20,18 @@ post: title: description: The title the Product Option will be identified by i.e. "Size" type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_{id}_options/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}_options/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -31,3 +43,15 @@ post: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_{id}_options_{option_id}.yaml b/docs/api/admin/paths/products_{id}_options_{option_id}.yaml index c63c57913a..4340cb8d71 100644 --- a/docs/api/admin/paths/products_{id}_options_{option_id}.yaml +++ b/docs/api/admin/paths/products_{id}_options_{option_id}.yaml @@ -19,6 +19,20 @@ delete: description: The ID of the Product Option. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/products_{id}_options_{option_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/products_{id}_options_{option_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -41,6 +55,18 @@ delete: default: true product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostProductsProductOptionsOption summary: Update a Product Option. @@ -69,6 +95,19 @@ post: title: description: The title of the Product Option type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/products_{id}_options_{option_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}_options_{option_id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -80,3 +119,15 @@ post: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_{id}_variants.yaml b/docs/api/admin/paths/products_{id}_variants.yaml index a4319c6c8d..deba2afb22 100644 --- a/docs/api/admin/paths/products_{id}_variants.yaml +++ b/docs/api/admin/paths/products_{id}_variants.yaml @@ -119,6 +119,18 @@ post: value: description: The value to give for the Product Option. type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_{id}_variants/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}_variants/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -130,6 +142,18 @@ post: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetProductsProductVariants summary: List a Product's Product Variants @@ -164,6 +188,14 @@ get: schema: type: integer default: 100 + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}_variants/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -186,3 +218,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/products_{id}_variants_{variant_id}.yaml b/docs/api/admin/paths/products_{id}_variants_{variant_id}.yaml index 8dde101221..6f2d4ba76b 100644 --- a/docs/api/admin/paths/products_{id}_variants_{variant_id}.yaml +++ b/docs/api/admin/paths/products_{id}_variants_{variant_id}.yaml @@ -16,6 +16,20 @@ delete: description: The ID of the Product Variant. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/products_{id}_variants_{variant_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/products_{id}_variants_{variant_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -38,6 +52,18 @@ delete: default: true product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostProductsProductVariantsVariant summary: Update a Product Variant @@ -60,6 +86,8 @@ post: content: application/json: schema: + required: + - prices properties: title: description: The title to identify the Product Variant by. @@ -158,6 +186,20 @@ post: value: description: The value to give for the Product Option. type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/products_{id}_variants_{variant_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/products_{id}_variants_{variant_id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product responses: @@ -169,3 +211,15 @@ post: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions.yaml b/docs/api/admin/paths/regions.yaml index 6ca2f8a3da..1a95d30aa3 100644 --- a/docs/api/admin/paths/regions.yaml +++ b/docs/api/admin/paths/regions.yaml @@ -53,6 +53,18 @@ post: type: array items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -64,6 +76,18 @@ post: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetRegions summary: List Regions @@ -108,6 +132,18 @@ get: description: >- Date comparison for when resulting region was deleted, i.e. less than, greater than etc. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -130,3 +166,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}.yaml b/docs/api/admin/paths/regions_{id}.yaml index 5dbf6ca17a..9c6b4dc600 100644 --- a/docs/api/admin/paths/regions_{id}.yaml +++ b/docs/api/admin/paths/regions_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Region. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetRegionsRegion summary: Retrieve a Region @@ -42,6 +66,18 @@ get: description: The ID of the Region. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -53,6 +89,18 @@ get: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostRegionsRegion summary: Update a Region @@ -122,6 +170,18 @@ post: type: array items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -133,3 +193,15 @@ post: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}_countries.yaml b/docs/api/admin/paths/regions_{id}_countries.yaml index 4bab7c3d58..b2404bfd9e 100644 --- a/docs/api/admin/paths/regions_{id}_countries.yaml +++ b/docs/api/admin/paths/regions_{id}_countries.yaml @@ -24,6 +24,18 @@ post: url: >- https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements description: See a list of codes. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions_{id}_countries/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}_countries/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -35,3 +47,15 @@ post: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}_countries_{country_code}.yaml b/docs/api/admin/paths/regions_{id}_countries_{country_code}.yaml index b0f5b2c8d1..86f44aadef 100644 --- a/docs/api/admin/paths/regions_{id}_countries_{country_code}.yaml +++ b/docs/api/admin/paths/regions_{id}_countries_{country_code}.yaml @@ -19,6 +19,20 @@ delete: externalDocs: url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes description: See a list of codes. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/regions_{id}_countries_{country_code}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/regions_{id}_countries_{country_code}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -30,3 +44,15 @@ delete: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}_fulfillment-options.yaml b/docs/api/admin/paths/regions_{id}_fulfillment-options.yaml index 16a5b4a85a..b25191d7df 100644 --- a/docs/api/admin/paths/regions_{id}_fulfillment-options.yaml +++ b/docs/api/admin/paths/regions_{id}_fulfillment-options.yaml @@ -10,6 +10,19 @@ get: description: The ID of the Region. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/regions_{id}_fulfillment-options/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}_fulfillment-options/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -33,3 +46,15 @@ get: - id: manual-fulfillment - id: manual-fulfillment-return is_return: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}_fulfillment-providers.yaml b/docs/api/admin/paths/regions_{id}_fulfillment-providers.yaml index f01f857fe3..129611bdcf 100644 --- a/docs/api/admin/paths/regions_{id}_fulfillment-providers.yaml +++ b/docs/api/admin/paths/regions_{id}_fulfillment-providers.yaml @@ -20,6 +20,19 @@ post: provider_id: description: The ID of the Fulfillment Provider to add. type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/regions_{id}_fulfillment-providers/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}_fulfillment-providers/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -31,3 +44,15 @@ post: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}_fulfillment-providers_{provider_id}.yaml b/docs/api/admin/paths/regions_{id}_fulfillment-providers_{provider_id}.yaml index 9e73c6f45b..02598841a0 100644 --- a/docs/api/admin/paths/regions_{id}_fulfillment-providers_{provider_id}.yaml +++ b/docs/api/admin/paths/regions_{id}_fulfillment-providers_{provider_id}.yaml @@ -16,6 +16,20 @@ delete: description: The ID of the Fulfillment Provider. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/regions_{id}_fulfillment-providers_{provider_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -27,3 +41,15 @@ delete: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}_payment-providers.yaml b/docs/api/admin/paths/regions_{id}_payment-providers.yaml index 80ba28f73a..44b68388af 100644 --- a/docs/api/admin/paths/regions_{id}_payment-providers.yaml +++ b/docs/api/admin/paths/regions_{id}_payment-providers.yaml @@ -20,6 +20,19 @@ post: provider_id: description: The ID of the Payment Provider to add. type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/regions_{id}_payment-providers/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}_payment-providers/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -31,3 +44,15 @@ post: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/regions_{id}_payment-providers_{provider_id}.yaml b/docs/api/admin/paths/regions_{id}_payment-providers_{provider_id}.yaml index 27e03641fe..dfb28117d3 100644 --- a/docs/api/admin/paths/regions_{id}_payment-providers_{provider_id}.yaml +++ b/docs/api/admin/paths/regions_{id}_payment-providers_{provider_id}.yaml @@ -16,6 +16,20 @@ delete: description: The ID of the Payment Provider. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/regions_{id}_payment-providers_{provider_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/regions_{id}_payment-providers_{provider_id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Region responses: @@ -27,3 +41,15 @@ delete: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/return-reasons.yaml b/docs/api/admin/paths/return-reasons.yaml index 8219cd0a96..ca2841f809 100644 --- a/docs/api/admin/paths/return-reasons.yaml +++ b/docs/api/admin/paths/return-reasons.yaml @@ -28,6 +28,18 @@ post: metadata: description: An optional set of key-value pairs with additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/return-reasons/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/return-reasons/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return Reason responses: @@ -39,11 +51,35 @@ post: properties: return_reason: $ref: ../components/schemas/return_reason.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetReturnReasons summary: List Return Reasons description: Retrieves a list of Return Reasons. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/return-reasons/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/return-reasons/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return Reason responses: @@ -57,3 +93,15 @@ get: type: array items: $ref: ../components/schemas/return_reason.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/return-reasons_{id}.yaml b/docs/api/admin/paths/return-reasons_{id}.yaml index c8b01a4aa5..603c6dc483 100644 --- a/docs/api/admin/paths/return-reasons_{id}.yaml +++ b/docs/api/admin/paths/return-reasons_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the return reason schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/return-reasons_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/return-reasons_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return Reason responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetReturnReasonsReason summary: Retrieve a Return Reason @@ -42,6 +66,18 @@ get: description: The ID of the Return Reason. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/return-reasons_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/return-reasons_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return Reason responses: @@ -53,6 +89,18 @@ get: properties: return_reason: $ref: ../components/schemas/return_reason.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostReturnReasonsReason summary: Update a Return Reason @@ -84,6 +132,18 @@ post: metadata: description: An optional set of key-value pairs with additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/return-reasons_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/return-reasons_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return Reason responses: @@ -95,3 +155,15 @@ post: properties: return_reason: $ref: ../components/schemas/return_reason.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/returns.yaml b/docs/api/admin/paths/returns.yaml index 4af7b6557e..c77387d735 100644 --- a/docs/api/admin/paths/returns.yaml +++ b/docs/api/admin/paths/returns.yaml @@ -15,6 +15,18 @@ get: schema: type: number default: '0' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/returns/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/returns/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return responses: @@ -37,3 +49,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/returns_{id}_cancel.yaml b/docs/api/admin/paths/returns_{id}_cancel.yaml index 6862b58e55..0ca536a9a7 100644 --- a/docs/api/admin/paths/returns_{id}_cancel.yaml +++ b/docs/api/admin/paths/returns_{id}_cancel.yaml @@ -9,6 +9,18 @@ post: description: The ID of the Return. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/returns_{id}_cancel/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/returns_{id}_cancel/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return responses: @@ -20,3 +32,15 @@ post: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/returns_{id}_receive.yaml b/docs/api/admin/paths/returns_{id}_receive.yaml index 038679f62e..0c6986d3f1 100644 --- a/docs/api/admin/paths/returns_{id}_receive.yaml +++ b/docs/api/admin/paths/returns_{id}_receive.yaml @@ -35,6 +35,18 @@ post: refund: description: The amount to refund. type: number + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/returns_{id}_receive/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/returns_{id}_receive/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Return responses: @@ -46,3 +58,15 @@ post: properties: return: $ref: ../components/schemas/return.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/sales-channels.yaml b/docs/api/admin/paths/sales-channels.yaml index 61dbcac072..3f05405e78 100644 --- a/docs/api/admin/paths/sales-channels.yaml +++ b/docs/api/admin/paths/sales-channels.yaml @@ -19,6 +19,18 @@ post: is_disabled: description: Whether the Sales Channel is disabled or not. type: boolean + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/sales-channels/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/sales-channels/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Sales Channel responses: @@ -30,6 +42,18 @@ post: properties: sales_channel: $ref: ../components/schemas/sales_channel.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetSalesChannels summary: List sales channels @@ -153,6 +177,18 @@ get: of the result. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/sales-channels/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/sales-channels/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Sales Channel responses: @@ -175,3 +211,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/sales-channels_{id}.yaml b/docs/api/admin/paths/sales-channels_{id}.yaml index 222272b5a3..36d65d7784 100644 --- a/docs/api/admin/paths/sales-channels_{id}.yaml +++ b/docs/api/admin/paths/sales-channels_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Sales channel. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/sales-channels_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/sales-channels_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Sales Channel responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetSalesChannelsSalesChannel summary: Retrieve a sales channel @@ -42,6 +66,18 @@ get: description: The ID of the Sales channel. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/sales-channels_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/sales-channels_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Sales Channel responses: @@ -53,6 +89,18 @@ get: properties: sales_channel: $ref: ../components/schemas/sales_channel.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostSalesChannelsSalesChannel summary: Update a Sales Channel @@ -79,6 +127,18 @@ post: is_disabled: type: boolean description: Indication of if the sales channel is active. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/sales-channels_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/sales-channels_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Sales Channel responses: @@ -90,3 +150,15 @@ post: properties: sales_channel: $ref: ../components/schemas/sales_channel.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/sales-channels_{id}_products_batch.yaml b/docs/api/admin/paths/sales-channels_{id}_products_batch.yaml index e1631b42f9..f2c506cd1a 100644 --- a/docs/api/admin/paths/sales-channels_{id}_products_batch.yaml +++ b/docs/api/admin/paths/sales-channels_{id}_products_batch.yaml @@ -28,6 +28,19 @@ post: id: type: string description: The ID of the product + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/sales-channels_{id}_products_batch/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/sales-channels_{id}_products_batch/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Sales Channel responses: @@ -39,6 +52,18 @@ post: properties: sales_channel: $ref: ../components/schemas/sales_channel.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteSalesChannelsChannelProductsBatch summary: Remove a list of products from a sales channel @@ -69,6 +94,20 @@ delete: id: description: The ID of a product type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/sales-channels_{id}_products_batch/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/sales-channels_{id}_products_batch/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Sales Channel responses: @@ -80,3 +119,15 @@ delete: properties: sales_channel: $ref: ../components/schemas/sales_channel.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/shipping-options.yaml b/docs/api/admin/paths/shipping-options.yaml index 63efe277fd..e853509aa7 100644 --- a/docs/api/admin/paths/shipping-options.yaml +++ b/docs/api/admin/paths/shipping-options.yaml @@ -74,6 +74,18 @@ post: metadata: description: An optional set of key-value pairs with additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-options/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-options/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Option responses: @@ -85,6 +97,18 @@ post: properties: shipping_option: $ref: ../components/schemas/shipping_option.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetShippingOptions summary: List Shipping Options @@ -106,6 +130,18 @@ get: schema: type: boolean description: Flag for fetching admin specific options + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-options/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-options/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Option responses: @@ -122,3 +158,15 @@ get: count: type: integer description: The total number of items available + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/shipping-options_{id}.yaml b/docs/api/admin/paths/shipping-options_{id}.yaml index 021185a0a9..dc6e3a0496 100644 --- a/docs/api/admin/paths/shipping-options_{id}.yaml +++ b/docs/api/admin/paths/shipping-options_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Shipping Option. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-options_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-options_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Option responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetShippingOptionsOption summary: Retrieve a Shipping Option @@ -42,6 +66,18 @@ get: description: The ID of the Shipping Option. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-options_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-options_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Option responses: @@ -53,6 +89,18 @@ get: properties: shipping_option: $ref: ../components/schemas/shipping_option.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostShippingOptionsOption summary: Update Shipping Option @@ -106,6 +154,18 @@ post: amount: description: The amount to compare with. type: integer + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-options_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-options_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Option responses: @@ -117,3 +177,15 @@ post: properties: shipping_option: $ref: ../components/schemas/shipping_option.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/shipping-profiles.yaml b/docs/api/admin/paths/shipping-profiles.yaml index 199c2a7999..e55229bf45 100644 --- a/docs/api/admin/paths/shipping-profiles.yaml +++ b/docs/api/admin/paths/shipping-profiles.yaml @@ -13,6 +13,18 @@ post: name: description: The name of the Shipping Profile type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-profiles/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-profiles/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Profile responses: @@ -24,11 +36,35 @@ post: properties: shipping_profile: $ref: ../components/schemas/shipping_profile.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetShippingProfiles summary: List Shipping Profiles description: Retrieves a list of Shipping Profile. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-profiles/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-profiles/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Profile responses: @@ -42,3 +78,15 @@ get: type: array items: $ref: ../components/schemas/shipping_profile.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/shipping-profiles_{id}.yaml b/docs/api/admin/paths/shipping-profiles_{id}.yaml index 69bb1b5f75..cd38ca1cbd 100644 --- a/docs/api/admin/paths/shipping-profiles_{id}.yaml +++ b/docs/api/admin/paths/shipping-profiles_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Shipping Profile. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-profiles_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-profiles_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Profile responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetShippingProfilesProfile summary: Retrieve a Shipping Profile @@ -42,6 +66,18 @@ get: description: The ID of the Shipping Profile. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-profiles_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-profiles_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Profile responses: @@ -53,6 +89,18 @@ get: properties: shipping_profile: $ref: ../components/schemas/shipping_profile.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostShippingProfilesProfile summary: Update a Shipping Profiles @@ -72,6 +120,18 @@ post: name: description: The name of the Shipping Profile type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-profiles_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-profiles_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Shipping Profile responses: @@ -83,3 +143,15 @@ post: properties: shipping_profile: $ref: ../components/schemas/shipping_profile.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/store.yaml b/docs/api/admin/paths/store.yaml index b7b5bd1a6e..28acac43d5 100644 --- a/docs/api/admin/paths/store.yaml +++ b/docs/api/admin/paths/store.yaml @@ -3,6 +3,18 @@ get: summary: Retrieve Store details. description: Retrieves the Store details x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/store/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/store/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Store responses: @@ -14,6 +26,18 @@ get: properties: store: $ref: ../components/schemas/store.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostStore summary: Update Store details. @@ -56,6 +80,18 @@ post: metadata: description: An optional set of key-value pairs with additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/store/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/store/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Store responses: @@ -67,3 +103,15 @@ post: properties: store: $ref: ../components/schemas/store.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/store_currencies_{code}.yaml b/docs/api/admin/paths/store_currencies_{code}.yaml index 1b7000d7e0..d7f9890791 100644 --- a/docs/api/admin/paths/store_currencies_{code}.yaml +++ b/docs/api/admin/paths/store_currencies_{code}.yaml @@ -13,6 +13,18 @@ post: externalDocs: url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes description: See a list of codes. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/store_currencies_{code}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/store_currencies_{code}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Store responses: @@ -24,6 +36,18 @@ post: properties: store: $ref: ../components/schemas/store.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteStoreCurrenciesCode summary: Remove a Currency Code @@ -39,6 +63,18 @@ delete: externalDocs: url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes description: See a list of codes. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/store_currencies_{code}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/store_currencies_{code}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Store responses: @@ -50,3 +86,15 @@ delete: properties: store: $ref: ../components/schemas/store.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/store_payment-providers.yaml b/docs/api/admin/paths/store_payment-providers.yaml index 1e5aa37c71..fde884b5a1 100644 --- a/docs/api/admin/paths/store_payment-providers.yaml +++ b/docs/api/admin/paths/store_payment-providers.yaml @@ -3,6 +3,18 @@ get: summary: Retrieve configured Payment Providers description: Retrieves the configured Payment Providers x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/store_payment-providers/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/store_payment-providers/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Store responses: @@ -16,3 +28,15 @@ get: type: array items: $ref: ../components/schemas/payment_provider.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/store_tax-providers.yaml b/docs/api/admin/paths/store_tax-providers.yaml index 540f80edfa..0736e1a9ad 100644 --- a/docs/api/admin/paths/store_tax-providers.yaml +++ b/docs/api/admin/paths/store_tax-providers.yaml @@ -3,6 +3,18 @@ get: summary: Retrieve configured Tax Providers description: Retrieves the configured Tax Providers x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/store_tax-providers/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/store_tax-providers/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Store responses: @@ -16,3 +28,15 @@ get: type: array items: $ref: ../components/schemas/tax_provider.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/swaps.yaml b/docs/api/admin/paths/swaps.yaml index 9b5d24c9e2..9b3112d577 100644 --- a/docs/api/admin/paths/swaps.yaml +++ b/docs/api/admin/paths/swaps.yaml @@ -16,6 +16,18 @@ get: type: number default: '0' x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/swaps/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/swaps/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Swap responses: @@ -38,3 +50,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/swaps_{id}.yaml b/docs/api/admin/paths/swaps_{id}.yaml index 885878ad3c..5f68093aef 100644 --- a/docs/api/admin/paths/swaps_{id}.yaml +++ b/docs/api/admin/paths/swaps_{id}.yaml @@ -10,6 +10,18 @@ get: description: The ID of the Swap. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/swaps_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/swaps_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Swap responses: @@ -21,3 +33,15 @@ get: properties: swap: $ref: ../components/schemas/swap.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/tax-rates.yaml b/docs/api/admin/paths/tax-rates.yaml index 5032d3164b..f0ebc9d6eb 100644 --- a/docs/api/admin/paths/tax-rates.yaml +++ b/docs/api/admin/paths/tax-rates.yaml @@ -58,6 +58,18 @@ post: description: The IDs of the types of products associated with this tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/tax-rates/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -69,6 +81,18 @@ post: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetTaxRates summary: List Tax Rates @@ -148,6 +172,18 @@ get: type: array items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/tax-rates/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -170,3 +206,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/tax-rates_{id}.yaml b/docs/api/admin/paths/tax-rates_{id}.yaml index 3bfc66b991..0eac0350c8 100644 --- a/docs/api/admin/paths/tax-rates_{id}.yaml +++ b/docs/api/admin/paths/tax-rates_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the Shipping Option. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/tax-rates_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetTaxRatesTaxRate summary: Get Tax Rate @@ -60,6 +84,18 @@ get: items: type: string x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/tax-rates_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -71,6 +107,18 @@ get: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostTaxRatesTaxRate summary: Update a Tax Rate @@ -133,6 +181,18 @@ post: description: The IDs of the types of products associated with this tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/tax-rates_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -144,3 +204,15 @@ post: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/tax-rates_{id}_product-types_batch.yaml b/docs/api/admin/paths/tax-rates_{id}_product-types_batch.yaml index e679359cae..4a2d13dc38 100644 --- a/docs/api/admin/paths/tax-rates_{id}_product-types_batch.yaml +++ b/docs/api/admin/paths/tax-rates_{id}_product-types_batch.yaml @@ -40,6 +40,19 @@ post: description: The IDs of the types of products to associate with this tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/tax-rates_{id}_product-types_batch/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates_{id}_product-types_batch/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -51,6 +64,18 @@ post: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteTaxRatesTaxRateProductTypes summary: Remove Tax Rate from Product Types @@ -95,6 +120,20 @@ delete: tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/tax-rates_{id}_product-types_batch/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/tax-rates_{id}_product-types_batch/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -106,3 +145,15 @@ delete: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/tax-rates_{id}_products_batch.yaml b/docs/api/admin/paths/tax-rates_{id}_products_batch.yaml index 90cf42b2ae..d2719b85d1 100644 --- a/docs/api/admin/paths/tax-rates_{id}_products_batch.yaml +++ b/docs/api/admin/paths/tax-rates_{id}_products_batch.yaml @@ -40,6 +40,18 @@ post: description: The IDs of the products to associate with this tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/tax-rates_{id}_products_batch/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates_{id}_products_batch/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -51,6 +63,18 @@ post: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteTaxRatesTaxRateProducts summary: Removes Tax Rate from Products @@ -93,6 +117,19 @@ delete: description: The IDs of the products to remove association with this tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/tax-rates_{id}_products_batch/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/tax-rates_{id}_products_batch/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -104,3 +141,15 @@ delete: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/tax-rates_{id}_shipping-options_batch.yaml b/docs/api/admin/paths/tax-rates_{id}_shipping-options_batch.yaml index 066ce03681..73aaea532a 100644 --- a/docs/api/admin/paths/tax-rates_{id}_shipping-options_batch.yaml +++ b/docs/api/admin/paths/tax-rates_{id}_shipping-options_batch.yaml @@ -40,6 +40,20 @@ post: description: The IDs of the shipping options to associate with this tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/tax-rates_{id}_shipping-options_batch/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -51,6 +65,18 @@ post: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml delete: operationId: DeleteTaxRatesTaxRateShippingOptions summary: Removes a Tax Rate from Product Types @@ -95,6 +121,20 @@ delete: tax rate items: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/tax-rates_{id}_shipping-options_batch/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/tax-rates_{id}_shipping-options_batch/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Tax Rate responses: @@ -106,3 +146,15 @@ delete: properties: tax_rate: $ref: ../components/schemas/tax_rate.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/uploads.yaml b/docs/api/admin/paths/uploads.yaml index 9c16a13004..0cf9fa1aff 100644 --- a/docs/api/admin/paths/uploads.yaml +++ b/docs/api/admin/paths/uploads.yaml @@ -3,8 +3,6 @@ post: summary: Uploads a file description: Uploads a file to the specific fileservice that is installed in Medusa. x-authenticated: true - tags: - - Upload requestBody: content: multipart/form-data: @@ -14,6 +12,20 @@ post: files: type: string format: binary + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/uploads/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/uploads/postundefined + security: + - api_token: [] + - cookie_auth: [] + tags: + - Upload responses: '200': description: OK @@ -30,3 +42,15 @@ post: type: string description: The URL of the uploaded file. format: uri + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/users.yaml b/docs/api/admin/paths/users.yaml index 8d3f93b8fa..25e87e070d 100644 --- a/docs/api/admin/paths/users.yaml +++ b/docs/api/admin/paths/users.yaml @@ -32,6 +32,18 @@ post: description: The Users password. type: string format: password + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/users/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/users/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - User responses: @@ -43,11 +55,35 @@ post: properties: user: $ref: ../components/schemas/user.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetUsers summary: Retrieve all users description: Retrieves all users. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/users/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/users/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - User responses: @@ -61,3 +97,15 @@ get: type: array items: $ref: ../components/schemas/user.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/users_password-token.yaml b/docs/api/admin/paths/users_password-token.yaml index 454c020560..a2894195f5 100644 --- a/docs/api/admin/paths/users_password-token.yaml +++ b/docs/api/admin/paths/users_password-token.yaml @@ -14,8 +14,32 @@ post: description: The Users email. type: string format: email + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/users_password-token/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/users_password-token/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - User responses: '204': description: OK + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/users_reset-password.yaml b/docs/api/admin/paths/users_reset-password.yaml index c092a38a1b..f887dff542 100644 --- a/docs/api/admin/paths/users_reset-password.yaml +++ b/docs/api/admin/paths/users_reset-password.yaml @@ -22,6 +22,18 @@ post: description: The Users new password. type: string format: password + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/users_reset-password/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/users_reset-password/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - User responses: @@ -33,3 +45,15 @@ post: properties: user: $ref: ../components/schemas/user.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/users_{id}.yaml b/docs/api/admin/paths/users_{id}.yaml index 5fb9c49727..d9b6412200 100644 --- a/docs/api/admin/paths/users_{id}.yaml +++ b/docs/api/admin/paths/users_{id}.yaml @@ -10,6 +10,18 @@ delete: description: The ID of the User. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/users_{id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/users_{id}/deleteundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Users responses: @@ -30,6 +42,18 @@ delete: type: boolean description: Whether or not the items were deleted. default: true + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetUsersUser summary: Retrieve a User @@ -42,6 +66,18 @@ get: description: The ID of the User. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/users_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/users_{id}/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - User responses: @@ -53,6 +89,18 @@ get: properties: user: $ref: ../components/schemas/user.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostUsersUser summary: Update a User @@ -89,6 +137,18 @@ post: metadata: description: An optional set of key-value pairs with additional information. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/users_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/users_{id}/postundefined + security: + - api_token: [] + - cookie_auth: [] tags: - User responses: @@ -100,3 +160,15 @@ post: properties: user: $ref: ../components/schemas/user.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/admin/paths/variants.yaml b/docs/api/admin/paths/variants.yaml index aa468d5094..f1a616477f 100644 --- a/docs/api/admin/paths/variants.yaml +++ b/docs/api/admin/paths/variants.yaml @@ -21,6 +21,18 @@ get: schema: type: integer default: 20 + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/variants/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/variants/getundefined + security: + - api_token: [] + - cookie_auth: [] tags: - Product Variant responses: @@ -43,3 +55,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store-spec3-base.json b/docs/api/store-spec3-base.json deleted file mode 100644 index 777afcd8fb..0000000000 --- a/docs/api/store-spec3-base.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Medusa Storefront API", - "description": "API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`.", - "license": { - "name": "MIT", - "url": "https://github.com/medusajs/medusa/blob/master/LICENSE" - } - }, - "tags": [ - { - "name": "Auth", - "description": "Auth endpoints that allow authorization of customers and manages their sessions." - }, - { - "name": "Cart", - "description": "Cart endpoints that allow handling carts in Medusa.", - "x-resourceId": "cart" - }, - { - "name": "Collection", - "description": "Collection endpoints that allow handling collections in Medusa.", - "x-resourceId": "product_collection" - }, - { - "name": "Customer", - "description": "Customer endpoints that allow handling customers in Medusa.", - "x-resourceId": "customer" - }, - { - "name": "Gift Card", - "description": "Gift Card endpoints that allow handling gift cards in Medusa.", - "x-resourceId": "gift_card" - }, - { - "name": "Order", - "description": "Order endpoints that allow handling orders in Medusa.", - "x-resourceId": "order" - }, - { - "name": "Product", - "description": "Product endpoints that allow handling products in Medusa.", - "x-resourceId": "product" - }, - { - "name": "Product Variant", - "description": "Product Variant endpoints that allow handling product variants in Medusa.", - "x-resourceId": "product_variant" - }, - { - "name": "Region", - "description": "Region endpoints that allow handling regions in Medusa.", - "x-resourceId": "region" - }, - { - "name": "Return Reason", - "description": "Return Reason endpoints that allow handling return reasons in Medusa.", - "x-resourceId": "return_reason" - }, - { - "name": "Return", - "description": "Return endpoints that allow handling returns in Medusa.", - "x-resourceId": "return" - }, - { - "name": "Shipping Option", - "description": "Shipping Option endpoints that allow handling shipping options in Medusa.", - "x-resourceId": "shipping_option" - }, - { - "name": "Swap", - "description": "Swap endpoints that allow handling swaps in Medusa.", - "x-resourceId": "swap" - } - ], - "servers": [ - { - "url": "https://api.medusa-commerce.com/store" - } - ], - "paths": {} -} diff --git a/docs/api/store-spec3-base.yaml b/docs/api/store-spec3-base.yaml new file mode 100644 index 0000000000..c7b0babcc8 --- /dev/null +++ b/docs/api/store-spec3-base.yaml @@ -0,0 +1,227 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Medusa Storefront API + description: | + API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. + + ## Authentication + + To send requests as an authenticated customer, you must use the Cookie Session ID. + + + license: + name: MIT + url: https://github.com/medusajs/medusa/blob/master/LICENSE +tags: +- name: Auth + description: Auth endpoints that allow authorization of customers and manages their + sessions. +- name: Cart + description: Cart endpoints that allow handling carts in Medusa. + x-resourceId: cart +- name: Collection + description: Collection endpoints that allow handling collections in Medusa. + x-resourceId: product_collection +- name: Customer + description: Customer endpoints that allow handling customers in Medusa. + x-resourceId: customer +- name: Gift Card + description: Gift Card endpoints that allow handling gift cards in Medusa. + x-resourceId: gift_card +- name: Order + description: Order endpoints that allow handling orders in Medusa. + x-resourceId: order +- name: Product + description: Product endpoints that allow handling products in Medusa. + x-resourceId: product +- name: Product Variant + description: Product Variant endpoints that allow handling product variants in Medusa. + x-resourceId: product_variant +- name: Region + description: Region endpoints that allow handling regions in Medusa. + x-resourceId: region +- name: Return Reason + description: Return Reason endpoints that allow handling return reasons in Medusa. + x-resourceId: return_reason +- name: Return + description: Return endpoints that allow handling returns in Medusa. + x-resourceId: return +- name: Shipping Option + description: Shipping Option endpoints that allow handling shipping options in Medusa. + x-resourceId: shipping_option +- name: Swap + description: Swap endpoints that allow handling swaps in Medusa. + x-resourceId: swap +servers: +- url: https://api.medusa-commerce.com/store +paths: {} +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/multiple_errors" + examples: + not_allowed: + $ref: "#/components/examples/not_allowed_error" + invalid_data: + $ref: "#/components/examples/invalid_data_error" + multiple_errors: + $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: + cookie_auth: + type: apiKey + x-displayName: Cookie Session ID + in: cookie + name: connect.sid + 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 customer 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 customer](#tag/Auth/operation/PostAuth) and pass the cURL option `-v`: + + ```bash + curl -v --location --request POST 'https://medusa-url.com/store/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/store/customers/me/orders' \ + --header 'Cookie: connect.sid={sid}' + ``` + + Where `{sid}` is the value of `connect.sid` that you copied. \ No newline at end of file diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 191ec1abbc..edd7c578fe 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -1,8843 +1,8949 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Medusa Storefront API", - "description": "API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`.", - "license": { - "name": "MIT", - "url": "https://github.com/medusajs/medusa/blob/master/LICENSE" - } - }, - "tags": [ - { - "name": "Auth", - "description": "Auth endpoints that allow authorization of customers and manages their sessions." - }, - { - "name": "Cart", - "description": "Cart endpoints that allow handling carts in Medusa.", - "x-resourceId": "cart" - }, - { - "name": "Collection", - "description": "Collection endpoints that allow handling collections in Medusa.", - "x-resourceId": "product_collection" - }, - { - "name": "Customer", - "description": "Customer endpoints that allow handling customers in Medusa.", - "x-resourceId": "customer" - }, - { - "name": "Gift Card", - "description": "Gift Card endpoints that allow handling gift cards in Medusa.", - "x-resourceId": "gift_card" - }, - { - "name": "Order", - "description": "Order endpoints that allow handling orders in Medusa.", - "x-resourceId": "order" - }, - { - "name": "Product", - "description": "Product endpoints that allow handling products in Medusa.", - "x-resourceId": "product" - }, - { - "name": "Product Variant", - "description": "Product Variant endpoints that allow handling product variants in Medusa.", - "x-resourceId": "product_variant" - }, - { - "name": "Region", - "description": "Region endpoints that allow handling regions in Medusa.", - "x-resourceId": "region" - }, - { - "name": "Return Reason", - "description": "Return Reason endpoints that allow handling return reasons in Medusa.", - "x-resourceId": "return_reason" - }, - { - "name": "Return", - "description": "Return endpoints that allow handling returns in Medusa.", - "x-resourceId": "return" - }, - { - "name": "Shipping Option", - "description": "Shipping Option endpoints that allow handling shipping options in Medusa.", - "x-resourceId": "shipping_option" - }, - { - "name": "Swap", - "description": "Swap endpoints that allow handling swaps in Medusa.", - "x-resourceId": "swap" - } - ], - "servers": [ - { - "url": "https://api.medusa-commerce.com/store" - } - ], - "paths": { - "/auth": { - "post": { - "operationId": "PostAuth", - "summary": "Authenticate Customer", - "description": "Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser.", - "parameters": [], - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } +openapi: 3.0.0 +info: + version: 1.0.0 + title: Medusa Storefront API + description: > + API reference for Medusa's Storefront endpoints. All endpoints are prefixed + with `/store`. + + + ## Authentication + + + To send requests as an authenticated customer, you must use the Cookie + Session ID. + + + + license: + name: MIT + url: 'https://github.com/medusajs/medusa/blob/master/LICENSE' +tags: + - name: Auth + description: >- + Auth endpoints that allow authorization of customers and manages their + sessions. + - name: Cart + description: Cart endpoints that allow handling carts in Medusa. + x-resourceId: cart + - name: Collection + description: Collection endpoints that allow handling collections in Medusa. + x-resourceId: product_collection + - name: Customer + description: Customer endpoints that allow handling customers in Medusa. + x-resourceId: customer + - name: Gift Card + description: Gift Card endpoints that allow handling gift cards in Medusa. + x-resourceId: gift_card + - name: Order + description: Order endpoints that allow handling orders in Medusa. + x-resourceId: order + - name: Product + description: Product endpoints that allow handling products in Medusa. + x-resourceId: product + - name: Product Variant + description: Product Variant endpoints that allow handling product variants in Medusa. + x-resourceId: product_variant + - name: Region + description: Region endpoints that allow handling regions in Medusa. + x-resourceId: region + - name: Return Reason + description: Return Reason endpoints that allow handling return reasons in Medusa. + x-resourceId: return_reason + - name: Return + description: Return endpoints that allow handling returns in Medusa. + x-resourceId: return + - name: Shipping Option + description: Shipping Option endpoints that allow handling shipping options in Medusa. + x-resourceId: shipping_option + - name: Swap + description: Swap endpoints that allow handling swaps in Medusa. + x-resourceId: swap +servers: + - url: 'https://api.medusa-commerce.com/store' +paths: + /auth: + post: + operationId: PostAuth + summary: Authenticate Customer + description: >- + Logs a Customer in and authorizes them to view their details. Successful + authentication will set a session cookie in the Customer's browser. + parameters: [] + 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.auth.authenticate({ + email: 'user@example.com', + password: 'user@example.com' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/store/auth' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "email": "user@example.com", + "password": "supersecret" + }' + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + description: The Customer's email. + password: + type: string + description: The Customer's password. + delete: + operationId: DeleteAuth + summary: Log out + description: Destroys a Customer's authenticated session. + x-authenticated: true + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request DELETE 'https://medusa-url.com/store/auth' + \ + + --header 'Cookie: connect.sid={sid}' + security: + - 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 Session + description: Gets the currently logged in Customer. + x-authenticated: true + 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 + + medusa.auth.getSession() + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/store/auth' \ + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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/{email}': + get: + operationId: GetAuthEmail + summary: Check if email has account + description: Checks if a Customer with the given email has signed up. + parameters: + - in: path + name: email + schema: + type: string + format: email + required: true + description: The email to check if exists. + 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.auth.exists('user@example.com') + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/auth/user@example.com' \ + + --header 'Cookie: connect.sid={sid}' + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + exists: + type: boolean + description: Whether email exists or not. + '400': + $ref: '#/components/responses/400_error' + '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' + '/carts/{id}/shipping-methods': + post: + operationId: PostCartsCartShippingMethod + description: Adds a Shipping Method to the Cart. + summary: Add a Shipping Method + parameters: + - in: path + name: id + required: true + description: The cart ID. + 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 }) + + medusa.carts.addShippingMethod(cart_id, { + option_id + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/shipping-methods' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "option_id": "{option_id}", + }' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - option_id + properties: + option_id: + type: string + description: ID of the shipping option to create the method from + data: + type: object + description: >- + Used to hold any data that the shipping method may need to + process the fulfillment of the order. Look at the + documentation for your installed fulfillment providers to + find out what to send. + '/carts/{id}/taxes': + post: + summary: Calculate Cart Taxes + operationId: PostCartsCartTaxes + description: >- + Calculates taxes for a cart. Depending on the cart's region this may + involve making 3rd party API calls to a Tax Provider service. + parameters: + - in: path + name: id + required: true + description: The Cart ID. + schema: + type: string + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/taxes' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + '/carts/{id}/complete': + post: + summary: Complete a Cart + operationId: PostCartsCartComplete + description: >- + Completes a cart. The following steps will be performed. Payment + authorization is attempted and if more work is required, we simply + return the cart for further updates. If payment is authorized and order + is not yet created, we make sure to do so. The completion of a cart can + be performed idempotently with a provided header `Idempotency-Key`. If + not provided, we will generate one for the request. + parameters: + - in: path + name: id + required: true + description: The Cart id. + 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 }) + + medusa.carts.complete(cart_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/complete' + tags: + - Cart + responses: + '200': + description: >- + If a cart was successfully authorized, but requires further action + from the user the response body will contain the cart with an + updated payment session. If the Cart was successfully completed the + response body will contain the newly created Order. + content: + application/json: + schema: + properties: + type: + type: string + description: The type of the data property. + enum: + - order + - cart + - swap + data: + type: object + description: >- + The data of the result object. Its type depends on the + type field. + oneOf: + - type: object + description: >- + Cart was successfully authorized and order was placed + successfully. + properties: + order: + $ref: '#/components/schemas/order' + - type: object + description: >- + Cart was successfully authorized but requires further + actions. + properties: + cart: + $ref: '#/components/schemas/cart' + - type: object + description: >- + When cart is used for a swap and it has been completed + successfully. + properties: + cart: + $ref: '#/components/schemas/swap' + '400': + $ref: '#/components/responses/400_error' + '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' + /carts: + post: + summary: Create a Cart + operationId: PostCart + description: >- + Creates a Cart within the given region and with the initial items. If no + `region_id` is provided the cart will be associated with the first + Region available. If no items are provided the cart will be empty after + creation. If a user is logged in the cart's customer id and email will + be set. + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The ID of the Region to create the Cart in. + sales_channel_id: + type: string + description: >- + [EXPERIMENTAL] The ID of the Sales channel to create the + Cart in. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + items: + description: >- + An optional array of `variant_id`, `quantity` pairs to + generate Line Items from. + type: array + items: + required: + - variant_id + - quantity + properties: + variant_id: + description: >- + The id of the Product Variant to generate a Line Item + from. + type: string + quantity: + description: The quantity of the Product Variant to add + type: integer + context: + description: >- + An optional object to provide context to the Cart. The + `context` field is automatically populated with `ip` and + `user_agent` + type: object + example: + ip: '::1' + user_agent: Chrome + 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.carts.create() + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/store/carts' + tags: + - Cart + responses: + '200': + description: Successfully created a new Cart + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + '/carts/{id}/line-items': + post: + operationId: PostCartsCartLineItems + summary: Add a Line Item + description: >- + Generates a Line Item with a given Product Variant and adds it to the + Cart + parameters: + - in: path + name: id + required: true + description: The id of the Cart to add the Line Item to. + 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 }) + + medusa.carts.lineItems.create(cart_id, { + variant_id, + quantity: 1 + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/line-items' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "variant_id": "{variant_id}", + "quantity": 1 + }' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - variant_id + - quantity + properties: + variant_id: + type: string + description: >- + The id of the Product Variant to generate the Line Item + from. + quantity: + type: integer + description: The quantity of the Product Variant to add to the Line Item. + metadata: + type: object + description: >- + An optional key-value map with additional details about the + Line Item. + '/carts/{id}/payment-sessions': + post: + operationId: PostCartsCartPaymentSessions + summary: Initialize Payment Sessions + description: >- + Creates Payment Sessions for each of the available Payment Providers in + the Cart's Region. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + 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 }) + + medusa.carts.createPaymentSessions(cart_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + '/carts/{id}/discounts/{code}': + delete: + operationId: DeleteCartsCartDiscountsDiscount + description: Removes a Discount from a Cart. + summary: Remove Discount from Cart + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: code + required: true + description: The unique Discount code. + 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 }) + + medusa.carts.deleteDiscount(cart_id, code) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/carts/{id}/discounts/{code}' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + '/carts/{id}/line-items/{line_id}': + delete: + operationId: DeleteCartsCartLineItemsItem + summary: Delete a Line Item + description: Removes a Line Item from a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: line_id + required: true + description: The id of the Line Item. + 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 }) + + medusa.carts.lineItems.delete(cart_id, line_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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: PostCartsCartLineItemsItem + summary: Update a Line Item + description: Updates a Line Item if the desired quantity can be fulfilled. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: line_id + required: true + description: The id of the Line Item. + 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 }) + + medusa.carts.lineItems.update(cart_id, line_id, { + quantity: 1 + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "quantity": 1 + }' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - quantity + properties: + quantity: + type: integer + description: The quantity to set the Line Item to. + '/carts/{id}/payment-sessions/{provider_id}': + delete: + operationId: DeleteCartsCartPaymentSessionsSession + summary: Delete a Payment Session + description: >- + Deletes a Payment Session on a Cart. May be useful if a payment has + failed. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: >- + The id of the Payment Provider used to create the Payment Session to + be deleted. + 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 }) + + medusa.carts.deletePaymentSession(cart_id, 'manual') + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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: PostCartsCartPaymentSessionUpdate + summary: Update a Payment Session + description: Updates a Payment Session with additional data. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: The id of the payment provider. + 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 }) + + medusa.carts.updatePaymentSession(cart_id, 'manual', { + data: { } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "email", - "password" - ], - "properties": { - "email": { - "type": "string", - "description": "The Customer's email." - }, - "password": { - "type": "string", - "description": "The Customer's password." - } - } + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "data": {} + }' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: object + description: The data to update the payment session with. + '/carts/{id}': + get: + operationId: GetCartsCart + summary: Retrieve a Cart + description: Retrieves a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + 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 }) + + medusa.carts.retrieve(cart_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/carts/{id}' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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: PostCartsCart + summary: Update a Cart + description: Updates a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The id of the Region to create the Cart in. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + 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 Cart. + format: email + sales_channel_id: + type: string + description: The ID of the Sales channel to update the Cart with. + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address' + description: A full billing address object. + - type: string + description: The billing address ID + shipping_address: + description: The Address to be used for shipping. + anyOf: + - $ref: '#/components/schemas/address' + description: A full shipping address object. + - type: string + description: The shipping address ID + gift_cards: + description: An array of Gift Card codes to add to the Cart. + type: array + items: + required: + - code + properties: + code: + description: The code that a Gift Card is identified by. + type: string + discounts: + description: An array of Discount codes to add to the Cart. + type: array + items: + required: + - code + properties: + code: + description: The code that a Discount is identifed by. + type: string + customer_id: + description: The ID of the Customer to associate the Cart with. + type: string + context: + description: An optional object to provide context to the Cart. + type: object + example: + ip: '::1' + user_agent: Chrome + 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.carts.update(cart_id, { + email: 'user@example.com' + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + '/carts/{id}/payment-sessions/{provider_id}/refresh': + post: + operationId: PostCartsCartPaymentSessionsSession + summary: Refresh a Payment Session + description: >- + Refreshes a Payment Session to ensure that it is in sync with the Cart - + this is usually not necessary. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: >- + The id of the Payment Provider that created the Payment Session to + be refreshed. + 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 }) + + medusa.carts.refreshPaymentSession(cart_id, 'manual') + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual/refresh' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + '/carts/{id}/payment-session': + post: + operationId: PostCartsCartPaymentSession + summary: Select a Payment Session + description: >- + Selects a Payment Session as the session intended to be used towards the + completion of the Cart. + parameters: + - in: path + name: id + required: true + description: The ID of the Cart. + 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 }) + + medusa.carts.setPaymentSession(cart_id, { + provider_id: 'manual' + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "provider_id": "manual" + }' + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - provider_id + properties: + provider_id: + type: string + description: The ID of the Payment Provider. + '/collections/{id}': + get: + operationId: GetCollectionsCollection + summary: Retrieve a Product Collection + description: Retrieves a Product Collection. + parameters: + - in: path + name: id + required: true + description: The id of the Product Collection + 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 }) + + medusa.collections.retrieve(collection_id) + + .then(({ collection }) => { + console.log(collection.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/collections/{id}' + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collection: + $ref: '#/components/schemas/product_collection' + '400': + $ref: '#/components/responses/400_error' + '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: + get: + operationId: GetCollections + summary: List Product Collections + description: Retrieve a list of Product Collection. + parameters: + - in: query + name: offset + description: >- + The number of collections to skip before starting to collect the + collections set + schema: + type: integer + default: 0 + - in: query + name: limit + description: The number of collections to return + schema: + type: integer + default: 10 + - 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 + 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.collections.list() + + .then(({ collections, limit, offset, count }) => { + console.log(collections.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/collections' + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collections: + type: array + items: + $ref: '#/components/schemas/product_collection' + 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 + '400': + $ref: '#/components/responses/400_error' + '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/me/addresses: + post: + operationId: PostCustomersCustomerAddresses + summary: Add a Shipping Address + description: Adds a Shipping Address to a Customer's saved addresses. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - address + properties: + address: + description: The Address to add to the Customer. + anyOf: + - $ref: '#/components/schemas/address' + 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 + + medusa.customers.addresses.addAddress({ + address: { + first_name: 'Celia', + last_name: 'Schumm', + address_1: '225 Bednar Curve', + city: 'Danielville', + country_code: 'US', + postal_code: '85137', + phone: '981-596-6748 x90188', + company: 'Wyman LLC', + address_2: '', + province: 'Georgia', + metadata: {} } - } - } - } - }, - "delete": { - "operationId": "DeleteAuth", - "summary": "Log out", - "description": "Destroys a Customer's authenticated session.", - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK" - } - } - }, - "get": { - "operationId": "GetAuth", - "summary": "Get Session", - "description": "Gets the currently logged in Customer.", - "x-authenticated": true, - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me/addresses' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "address": { + "first_name": "Celia", + "last_name": "Schumm", + "address_1": "225 Bednar Curve", + "city": "Danielville", + "country_code": "US", + "postal_code": "85137" } - } - } - }, - "401": { - "description": "Unauthorized" - } - } - } - }, - "/auth/{email}": { - "get": { - "operationId": "GetAuthEmail", - "summary": "Check if email has account", - "description": "Checks if a Customer with the given email has signed up.", - "parameters": [ - { - "in": "path", - "name": "email", - "schema": { - "type": "string", - "format": "email" - }, - "required": true, - "description": "The email to check if exists." - } - ], - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "exists": { - "type": "boolean", - "description": "Whether email exists or not." - } - } + }' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: A successful response + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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 account. + requestBody: + content: + application/json: + schema: + required: + - first_name + - last_name + - email + - password + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + phone: + description: The Customer's phone number. + 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 }) + + medusa.customers.create({ + first_name: 'Alec', + last_name: 'Reynolds', + email: 'user@example.com', + password: 'supersecret' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Alec", + "last_name": "Reynolds", + "email": "user@example.com", + "password": "supersecret" + }' + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + description: A customer with the same email exists + content: + application/json: + schema: + properties: + code: + type: string + description: The error code + type: + type: string + description: The type of error + message: + type: string + description: Human-readable message with details about the error + example: + code: invalid_request_error + type: duplicate_error + message: >- + A customer with the given email already has an account. Log in + instead + '500': + $ref: '#/components/responses/500_error' + '/customers/me/addresses/{address_id}': + delete: + operationId: DeleteCustomersCustomerAddressesAddress + summary: Delete an Address + description: Removes an Address from the Customer's saved addresses. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to remove. + 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 + + medusa.customers.addresses.deleteAddress(address_id) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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: PostCustomersCustomerAddressesAddress + summary: Update a Shipping Address + description: Updates a Customer's saved Shipping Address. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to update. + schema: + type: string + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/address' + 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 + + medusa.customers.addresses.updateAddress(address_id, { + first_name: 'Gina' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Gina" + }' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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/me: + get: + operationId: GetCustomersCustomer + summary: Retrieves a Customer + description: >- + Retrieves a Customer - the Customer must be logged in to retrieve their + details. + x-authenticated: true + 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 + + medusa.customers.retrieve() + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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 Customer details + description: Updates a Customer's saved details. + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address' + description: The full billing address object + - type: string + description: The ID of an existing billing address + password: + description: The Customer's password. + type: string + phone: + description: The Customer's phone number. + type: string + email: + description: The email of the customer. + type: string + metadata: + description: Metadata about the customer. + type: object + 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 + + medusa.customers.update({ + first_name: 'Laury' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Laury" + }' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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/me/payment-methods: + get: + operationId: GetCustomersCustomerPaymentMethods + summary: Retrieve saved payment methods + description: >- + Retrieves a list of a Customer's saved payment methods. Payment methods + are saved with Payment Providers and it is their responsibility to fetch + saved methods. + x-authenticated: true + 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 + + medusa.customers.paymentMethods.list() + + .then(({ payment_methods }) => { + console.log(payment_methods.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me/payment-methods' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + payment_methods: + type: array + items: + properties: + provider_id: + type: string + description: >- + The id of the Payment Provider where the payment + method is saved. + data: + type: object + description: >- + The data needed for the Payment Provider to use the + saved payment method. + '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/me/orders: + get: + operationId: GetCustomersCustomerOrders + summary: Retrieve Customer Orders + description: Retrieves a list of a Customer's Orders. + x-authenticated: true + parameters: + - in: query + name: q + description: Query used for searching orders. + 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 + - in: query + name: fulfillment_status + style: form + explode: false + description: Fulfillment status to search for. + schema: + type: array + items: + type: string + - in: query + name: payment_status + style: form + explode: false + description: Payment status to search for. + schema: + type: array + items: + type: string + - 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: email + description: to search for. + schema: + type: string + - in: query + name: region_id + description: to search for. + schema: + type: string + - in: query + name: currency_code + description: to search for. + schema: + type: string + - in: query + name: tax_rate + description: to search for. + 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: canceled_at + description: Date comparison for when resulting collections 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: limit + description: How many orders to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The offset in the resulting orders. + schema: + type: integer + default: 0 + - in: query + name: fields + description: >- + (Comma separated string) Which fields should be included in the + resulting orders. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated string) Which relations should be expanded in the + resulting orders. + 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 + + medusa.customers.listOrders() + + .then(({ orders, limit, offset, count }) => { + console.log(orders); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me/orders' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + 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 + '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/password-token: + post: + operationId: PostCustomersCustomerPasswordToken + summary: Creates a reset password token + description: >- + Creates a reset password token to be used in a subsequent + /reset-password request. The password token should be sent out of band + e.g. via email and will not be returned. + requestBody: + content: + application/json: + schema: + required: + - email + properties: + email: + description: The email of the customer. + type: string + format: email + 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.customers.generatePasswordToken({ + email: 'user@example.com' + }) + + .then(() => { + // successful + }) + + .catch(() => { + // failed + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/password-token' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' + tags: + - Customer + 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' + /customers/password-reset: + post: + operationId: PostCustomersResetPassword + summary: Resets Customer password + description: >- + Resets a Customer's password using a password token created by a + previous /password-token request. + requestBody: + content: + application/json: + schema: + required: + - email + - password + - token + properties: + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + token: + description: The reset password token + 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 }) + + medusa.customers.resetPassword({ + email: 'user@example.com', + password: 'supersecret', + token: 'supersecrettoken' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/password-reset' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com", + "password": "supersecret", + "token": "supersecrettoken" + }' + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '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/{code}': + get: + operationId: GetGiftCardsCode + summary: Retrieve Gift Card by Code + description: Retrieves a Gift Card by its associated unqiue code. + parameters: + - in: path + name: code + required: true + description: The unique Gift Card code. + 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 }) + + medusa.giftCards.retrieve(code) + + .then(({ gift_card }) => { + console.log(gift_card.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/gift-cards/{code}' + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + '400': + $ref: '#/components/responses/400_error' + '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/cart/{cart_id}': + get: + operationId: GetOrdersOrderCartId + summary: Retrieves Order by Cart id + description: >- + Retrieves an Order by the id of the Cart that was used to create the + Order. + parameters: + - in: path + name: cart_id + required: true + description: The ID of Cart. + 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 }) + + medusa.orders.retrieveByCartId(cart_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders/cart/{id}' + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '400': + $ref: '#/components/responses/400_error' + '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: Retrieves an Order + description: Retrieves an Order + parameters: + - in: path + name: id + required: true + description: The id of the Order. + 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 }) + + medusa.orders.retrieve(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders/{id}' + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '400': + $ref: '#/components/responses/400_error' + '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: Look Up an Order + description: Look up an order using filters. + parameters: + - in: query + name: display_id + required: true + description: The display id given to the Order. + schema: + type: number + - in: query + name: email + style: form + explode: false + description: The email associated with this order. + required: true + schema: + type: string + format: email + - in: query + name: shipping_address + style: form + explode: false + description: The shipping address associated with this order. + schema: + type: object + properties: + postal_code: + type: string + description: The postal code of the shipping address + 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.orders.lookupOrder({ + display_id: 1, + email: 'user@example.com' + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders?display_id=1&email=user@example.com' + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '400': + $ref: '#/components/responses/400_error' + '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}': + get: + operationId: GetProductsProduct + summary: Retrieves a Product + description: Retrieves a Product. + parameters: + - in: path + name: id + required: true + description: The id of the Product. + 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 }) + + medusa.products.retrieve(product_id) + + .then(({ product }) => { + console.log(product.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/products/{id}' + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: '#/components/schemas/product' + '400': + $ref: '#/components/responses/400_error' + '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: + get: + operationId: GetProducts + summary: List Products + description: Retrieves a list of Products. + parameters: + - in: query + name: q + description: >- + Query used for searching products by title, description, variant's + title, variant's sku, and collection's title + schema: + type: string + - in: query + name: id + style: form + explode: false + description: product IDs to search for. + schema: + oneOf: + - type: string + - type: array + items: + type: string + - 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: 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: type + description: type to search for. + 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: 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: 100 + - 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-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.products.list() + + .then(({ products, limit, offset, count }) => { + console.log(products.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/products' + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + 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 + '400': + $ref: '#/components/responses/400_error' + '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/search: + post: + operationId: PostProductsSearch + summary: Search Products + description: >- + Run a search query on products using the search engine installed on + Medusa + parameters: + - in: query + name: q + required: true + description: The query to run the search with. + schema: + type: string + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: integer + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: integer + 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.products.search({ + q: 'Shirt' + }) + + .then(({ hits }) => { + console.log(hits.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/products/search?q=Shirt' + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + hits: + type: array + description: >- + Array of results. The format of the items depends on the + search engine installed on the server. + '400': + $ref: '#/components/responses/400_error' + '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}': + get: + operationId: GetRegionsRegion + summary: Retrieves a Region + description: Retrieves a Region. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + 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 }) + + medusa.regions.retrieve(region_id) + + .then(({ region }) => { + console.log(region.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/regions/{id}' + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '400': + $ref: '#/components/responses/400_error' + '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: + get: + operationId: GetRegions + summary: List Regions + description: Retrieves a list of Regions. + parameters: + - in: query + name: offset + description: How many regions to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of regions returned. + schema: + type: integer + default: 100 + - in: query + name: created_at + description: Date comparison for when resulting regions 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 regions 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-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.regions.list() + + .then(({ regions }) => { + console.log(regions.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/store/regions' + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + regions: + type: array + items: + $ref: '#/components/schemas/region' + '400': + $ref: '#/components/responses/400_error' + '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}': + get: + operationId: GetReturnReasonsReason + summary: Retrieve a Return Reason + description: Retrieves a Return Reason. + parameters: + - in: path + name: id + required: true + description: The id of the Return Reason. + 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 }) + + medusa.returnReasons.retrieve(reason_id) + + .then(({ return_reason }) => { + console.log(return_reason.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/return-reasons/{id}' + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reason: + $ref: '#/components/schemas/return_reason' + '400': + $ref: '#/components/responses/400_error' + '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: + get: + operationId: GetReturnReasons + summary: List Return Reasons + description: Retrieves a list of Return Reasons. + 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.returnReasons.list() + + .then(({ return_reasons }) => { + console.log(return_reasons.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/return-reasons' + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reasons: + type: array + items: + $ref: '#/components/schemas/return_reason' + '400': + $ref: '#/components/responses/400_error' + '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: + post: + operationId: PostReturns + summary: Create Return + description: Creates a Return for an Order. + requestBody: + content: + application/json: + schema: + required: + - order_id + - items + properties: + order_id: + type: string + description: The ID of the Order to create the Return from. + items: + description: The items to include in the Return. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item from the Order. + type: string + quantity: + description: The quantity to return. + type: integer + reason_id: + description: The ID of the return reason. + type: string + note: + description: A note to add to the item returned. + type: string + return_shipping: + description: >- + If the Return is to be handled by the store operator the + Customer can choose a Return Shipping Method. Alternatvely + the Customer can handle the Return themselves. + type: object + required: + - option_id + properties: + option_id: + type: string + description: >- + The ID of the Shipping Option to create the Shipping + Method from. + 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.returns.create({ + order_id, + items: [ + { + item_id, + quantity: 1 } - } - } - } - } - } - }, - "/carts/{id}/shipping-methods": { - "post": { - "operationId": "PostCartsCartShippingMethod", - "description": "Adds a Shipping Method to the Cart.", - "summary": "Add a Shipping Method", - "tags": [ - "Cart" - ], - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The cart ID.", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "option_id" - ], - "properties": { - "option_id": { - "type": "string", - "description": "ID of the shipping option to create the method from" - }, - "data": { - "type": "object", - "description": "Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send." - } - } - } - } - } - } - } - }, - "/carts/{id}/taxes": { - "post": { - "summary": "Calculate Cart Taxes", - "operationId": "PostCartsCartTaxes", - "description": "Calculates taxes for a cart. Depending on the cart's region this may involve making 3rd party API calls to a Tax Provider service.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The Cart ID.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/complete": { - "post": { - "summary": "Complete a Cart", - "operationId": "PostCartsCartComplete", - "description": "Completes a cart. The following steps will be performed. Payment authorization is attempted and if more work is required, we simply return the cart for further updates. If payment is authorized and order is not yet created, we make sure to do so. The completion of a cart can be performed idempotently with a provided header `Idempotency-Key`. If not provided, we will generate one for the request.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The Cart id.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "If a cart was successfully authorized, but requires further action from the user the response body will contain the cart with an updated payment session. If the Cart was successfully completed the response body will contain the newly created Order.", - "content": { - "application/json": { - "schema": { - "properties": { - "type": { - "type": "string", - "description": "The type of the data property.", - "enum": [ - "order", - "cart", - "swap" - ] - }, - "data": { - "type": "object", - "description": "The data of the result object. Its type depends on the type field.", - "oneOf": [ - { - "type": "object", - "description": "Cart was successfully authorized and order was placed successfully.", - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - }, - { - "type": "object", - "description": "Cart was successfully authorized but requires further actions.", - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - }, - { - "type": "object", - "description": "When cart is used for a swap and it has been completed successfully.", - "properties": { - "cart": { - "$ref": "#/components/schemas/swap" - } - } - } - ] - } - } - } - } - } - } - } - } - }, - "/carts": { - "post": { - "summary": "Create a Cart", - "operationId": "PostCart", - "description": "Creates a Cart within the given region and with the initial items. If no `region_id` is provided the cart will be associated with the first Region available. If no items are provided the cart will be empty after creation. If a user is logged in the cart's customer id and email will be set.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "region_id": { - "type": "string", - "description": "The ID of the Region to create the Cart in." - }, - "sales_channel_id": { - "type": "string", - "description": "[EXPERIMENTAL] The ID of the Sales channel to create the Cart in." - }, - "country_code": { - "type": "string", - "description": "The 2 character ISO country code to create the Cart in.", - "externalDocs": { - "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", - "description": "See a list of codes." - } - }, - "items": { - "description": "An optional array of `variant_id`, `quantity` pairs to generate Line Items from.", - "type": "array", - "items": { - "required": [ - "variant_id", - "quantity" - ], - "properties": { - "variant_id": { - "description": "The id of the Product Variant to generate a Line Item from.", - "type": "string" - }, - "quantity": { - "description": "The quantity of the Product Variant to add", - "type": "integer" - } - } - } - }, - "context": { - "description": "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`", - "type": "object", - "example": { - "ip": "::1", - "user_agent": "Chrome" - } - } - } - } - } - } - }, - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "Successfully created a new Cart", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/line-items": { - "post": { - "operationId": "PostCartsCartLineItems", - "summary": "Add a Line Item", - "description": "Generates a Line Item with a given Product Variant and adds it to the Cart", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart to add the Line Item to.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "variant_id", - "quantity" - ], - "properties": { - "variant_id": { - "type": "string", - "description": "The id of the Product Variant to generate the Line Item from." - }, - "quantity": { - "type": "integer", - "description": "The quantity of the Product Variant to add to the Line Item." - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details about the Line Item." - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-sessions": { - "post": { - "operationId": "PostCartsCartPaymentSessions", - "summary": "Initialize Payment Sessions", - "description": "Creates Payment Sessions for each of the available Payment Providers in the Cart's Region.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/discounts/{code}": { - "delete": { - "operationId": "DeleteCartsCartDiscountsDiscount", - "description": "Removes a Discount from a Cart.", - "summary": "Remove Discount from Cart", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "code", - "required": true, - "description": "The unique Discount code.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/line-items/{line_id}": { - "delete": { - "operationId": "DeleteCartsCartLineItemsItem", - "summary": "Delete a Line Item", - "description": "Removes a Line Item from a Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "line_id", - "required": true, - "description": "The id of the Line Item.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCartsCartLineItemsItem", - "summary": "Update a Line Item", - "description": "Updates a Line Item if the desired quantity can be fulfilled.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "line_id", - "required": true, - "description": "The id of the Line Item.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "quantity" - ], - "properties": { - "quantity": { - "type": "integer", - "description": "The quantity to set the Line Item to." - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-sessions/{provider_id}": { - "delete": { - "operationId": "DeleteCartsCartPaymentSessionsSession", - "summary": "Delete a Payment Session", - "description": "Deletes a Payment Session on a Cart. May be useful if a payment has failed.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "provider_id", - "required": true, - "description": "The id of the Payment Provider used to create the Payment Session to be deleted.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCartsCartPaymentSessionUpdate", - "summary": "Update a Payment Session", - "description": "Updates a Payment Session with additional data.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "provider_id", - "required": true, - "description": "The id of the payment provider.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "type": "object", - "description": "The data to update the payment session with." - } - } - } - } - } - } - } - }, - "/carts/{id}": { - "get": { - "operationId": "GetCartsCart", - "summary": "Retrieve a Cart", - "description": "Retrieves a Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCartsCart", - "summary": "Update a Cart", - "description": "Updates a Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "region_id": { - "type": "string", - "description": "The id of the Region to create the Cart in." - }, - "country_code": { - "type": "string", - "description": "The 2 character ISO country code to create the Cart in.", - "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 Cart.", - "format": "email" - }, - "sales_channel_id": { - "type": "string", - "description": "The ID of the Sales channel to update the Cart with." - }, - "billing_address": { - "description": "The Address to be used for billing purposes.", - "anyOf": [ - { - "$ref": "#/components/schemas/address", - "description": "A full billing address object." - }, - { - "type": "string", - "description": "The billing address ID" - } - ] - }, - "shipping_address": { - "description": "The Address to be used for shipping.", - "anyOf": [ - { - "$ref": "#/components/schemas/address", - "description": "A full shipping address object." - }, - { - "type": "string", - "description": "The shipping address ID" - } - ] - }, - "gift_cards": { - "description": "An array of Gift Card codes to add to the Cart.", - "type": "array", - "items": { - "required": [ - "code" - ], - "properties": { - "code": { - "description": "The code that a Gift Card is identified by.", - "type": "string" - } - } - } - }, - "discounts": { - "description": "An array of Discount codes to add to the Cart.", - "type": "array", - "items": { - "required": [ - "code" - ], - "properties": { - "code": { - "description": "The code that a Discount is identifed by.", - "type": "string" - } - } - } - }, - "customer_id": { - "description": "The ID of the Customer to associate the Cart with.", - "type": "string" - }, - "context": { - "description": "An optional object to provide context to the Cart.", - "type": "object", - "example": { - "ip": "::1", - "user_agent": "Chrome" - } - } - } - } - } - } - }, - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-sessions/{provider_id}/refresh": { - "post": { - "operationId": "PostCartsCartPaymentSessionsSession", - "summary": "Refresh a Payment Session", - "description": "Refreshes a Payment Session to ensure that it is in sync with the Cart - this is usually not necessary.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "provider_id", - "required": true, - "description": "The id of the Payment Provider that created the Payment Session to be refreshed.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-session": { - "post": { - "operationId": "PostCartsCartPaymentSession", - "summary": "Select a Payment Session", - "description": "Selects a Payment Session as the session intended to be used towards the completion of the Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The ID of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "provider_id" - ], - "properties": { - "provider_id": { - "type": "string", - "description": "The ID of the Payment Provider." - } - } - } - } - } - } - } - }, - "/collections/{id}": { - "get": { - "operationId": "GetCollectionsCollection", - "summary": "Retrieve a Product Collection", - "description": "Retrieves a Product Collection.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Product Collection", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - } - }, - "/collections": { - "get": { - "operationId": "GetCollections", - "summary": "List Product Collections", - "description": "Retrieve a list of Product Collection.", - "parameters": [ - { - "in": "query", - "name": "offset", - "description": "The number of collections to skip before starting to collect the collections set", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "in": "query", - "name": "limit", - "description": "The number of collections to return", - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "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" - } - } - } - } - ], - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collections": { - "type": "array", - "items": { - "$ref": "#/components/schemas/product_collection" - } - }, - "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" - } - } - } - } - } - } - } - } - }, - "/customers/me/addresses": { - "post": { - "operationId": "PostCustomersCustomerAddresses", - "summary": "Add a Shipping Address", - "description": "Adds a Shipping Address to a Customer's saved addresses.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "address" - ], - "properties": { - "address": { - "description": "The Address to add to the Customer.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "A successful response", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers": { - "post": { - "operationId": "PostCustomers", - "summary": "Create a Customer", - "description": "Creates a Customer account.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "first_name", - "last_name", - "email", - "password" - ], - "properties": { - "first_name": { - "description": "The Customer's first name.", - "type": "string" - }, - "last_name": { - "description": "The Customer's last name.", - "type": "string" - }, - "email": { - "description": "The email of the customer.", - "type": "string", - "format": "email" - }, - "password": { - "description": "The Customer's password.", - "type": "string", - "format": "password" - }, - "phone": { - "description": "The Customer's phone number.", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - }, - "422": { - "description": "A customer with the same email exists", - "content": { - "application/json": { - "schema": { - "properties": { - "code": { - "type": "string", - "description": "The error code" - }, - "type": { - "type": "string", - "description": "The type of error" - }, - "message": { - "type": "string", - "description": "Human-readable message with details about the error" - } - } - }, - "example": { - "code": "invalid_request_error", - "type": "duplicate_error", - "message": "A customer with the given email already has an account. Log in instead" - } - } - } - } - } - } - }, - "/customers/me/addresses/{address_id}": { - "delete": { - "operationId": "DeleteCustomersCustomerAddressesAddress", - "summary": "Delete an Address", - "description": "Removes an Address from the Customer's saved addresses.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "address_id", - "required": true, - "description": "The id of the Address to remove.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCustomersCustomerAddressesAddress", - "summary": "Update a Shipping Address", - "description": "Updates a Customer's saved Shipping Address.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "address_id", - "required": true, - "description": "The id of the Address to update.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "anyOf": [ + ] + }) + + .then(({ return }) => { + console.log(return.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/returns' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "order_id": "asfasf", + "items": [ { - "$ref": "#/components/schemas/address" + "item_id": "assfasf", + "quantity": 1 } ] - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers/me": { - "get": { - "operationId": "GetCustomersCustomer", - "summary": "Retrieves a Customer", - "description": "Retrieves a Customer - the Customer must be logged in to retrieve their details.", - "x-authenticated": true, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCustomersCustomer", - "summary": "Update Customer details", - "description": "Updates a Customer's saved details.", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "first_name": { - "description": "The Customer's first name.", - "type": "string" - }, - "last_name": { - "description": "The Customer's last name.", - "type": "string" - }, - "billing_address": { - "description": "The Address to be used for billing purposes.", - "anyOf": [ - { - "$ref": "#/components/schemas/address", - "description": "The full billing address object" - }, - { - "type": "string", - "description": "The ID of an existing billing address" - } - ] - }, - "password": { - "description": "The Customer's password.", - "type": "string" - }, - "phone": { - "description": "The Customer's phone number.", - "type": "string" - }, - "email": { - "description": "The email of the customer.", - "type": "string" - }, - "metadata": { - "description": "Metadata about the customer.", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers/me/payment-methods": { - "get": { - "operationId": "GetCustomersCustomerPaymentMethods", - "summary": "Retrieve saved payment methods", - "description": "Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods.", - "x-authenticated": true, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "payment_methods": { - "type": "array", - "items": { - "properties": { - "provider_id": { - "type": "string", - "description": "The id of the Payment Provider where the payment method is saved." - }, - "data": { - "type": "object", - "description": "The data needed for the Payment Provider to use the saved payment method." - } - } - } - } - } - } - } - } - } - } - } - }, - "/customers/me/orders": { - "get": { - "operationId": "GetCustomersCustomerOrders", - "summary": "Retrieve Customer Orders", - "description": "Retrieves a list of a Customer's Orders.", - "x-authenticated": true, - "parameters": [ - { - "in": "query", - "name": "q", - "description": "Query used for searching orders.", - "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" - } - } - }, - { - "in": "query", - "name": "fulfillment_status", - "style": "form", - "explode": false, - "description": "Fulfillment status to search for.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "in": "query", - "name": "payment_status", - "style": "form", - "explode": false, - "description": "Payment status to search for.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "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": "email", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "region_id", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "currency_code", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "tax_rate", - "description": "to search for.", - "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": "canceled_at", - "description": "Date comparison for when resulting collections 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": "limit", - "description": "How many orders to return.", - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "in": "query", - "name": "offset", - "description": "The offset in the resulting orders.", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "in": "query", - "name": "fields", - "description": "(Comma separated string) Which fields should be included in the resulting orders.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "expand", - "description": "(Comma separated string) Which relations should be expanded in the resulting orders.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/customers/password-token": { - "post": { - "operationId": "PostCustomersCustomerPasswordToken", - "summary": "Creates a reset password token", - "description": "Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "email" - ], - "properties": { - "email": { - "description": "The email of the customer.", - "type": "string", - "format": "email" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "204": { - "description": "OK" - } - } - } - }, - "/customers/password-reset": { - "post": { - "operationId": "PostCustomersResetPassword", - "summary": "Resets Customer password", - "description": "Resets a Customer's password using a password token created by a previous /password-token request.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "email", - "password", - "token" - ], - "properties": { - "email": { - "description": "The email of the customer.", - "type": "string", - "format": "email" - }, - "password": { - "description": "The Customer's password.", - "type": "string", - "format": "password" - }, - "token": { - "description": "The reset password token", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/gift-cards/{code}": { - "get": { - "operationId": "GetGiftCardsCode", - "summary": "Retrieve Gift Card by Code", - "description": "Retrieves a Gift Card by its associated unqiue code.", - "parameters": [ - { - "in": "path", - "name": "code", - "required": true, - "description": "The unique Gift Card code.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Gift Card" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "gift_card": { - "$ref": "#/components/schemas/gift_card" - } - } - } - } - } - } - } - } - }, - "/orders/cart/{cart_id}": { - "get": { - "operationId": "GetOrdersOrderCartId", - "summary": "Retrieves Order by Cart id", - "description": "Retrieves an Order by the id of the Cart that was used to create the Order.", - "parameters": [ - { - "in": "path", - "name": "cart_id", - "required": true, - "description": "The ID of Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}": { - "get": { - "operationId": "GetOrdersOrder", - "summary": "Retrieves an Order", - "description": "Retrieves an Order", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Order.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders": { - "get": { - "operationId": "GetOrders", - "summary": "Look Up an Order", - "description": "Look up an order using filters.", - "parameters": [ - { - "in": "query", - "name": "display_id", - "required": true, - "description": "The display id given to the Order.", - "schema": { - "type": "number" - } - }, - { - "in": "query", - "name": "email", - "style": "form", - "explode": false, - "description": "The email associated with this order.", - "required": true, - "schema": { - "type": "string", - "format": "email" - } - }, - { - "in": "query", - "name": "shipping_address", - "style": "form", - "explode": false, - "description": "The shipping address associated with this order.", - "schema": { - "type": "object", - "properties": { - "postal_code": { - "type": "string", - "description": "The postal code of the shipping address" - } - } - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/products/{id}": { - "get": { - "operationId": "GetProductsProduct", - "summary": "Retrieves a Product", - "description": "Retrieves a Product.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Product.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - }, - "/products": { - "get": { - "operationId": "GetProducts", - "summary": "List Products", - "description": "Retrieves a list of Products.", - "parameters": [ - { - "in": "query", - "name": "q", - "description": "Query used for searching products by title, description, variant's title, variant's sku, and collection's title", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "id", - "style": "form", - "explode": false, - "description": "product IDs to search for.", - "schema": { - "oneOf": [ + }' + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return: + $ref: '#/components/schemas/return' + '400': + $ref: '#/components/responses/400_error' + '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: + get: + operationId: GetShippingOptions + summary: Retrieve Shipping Options + description: Retrieves a list of Shipping Options. + parameters: + - in: query + name: is_return + description: >- + Whether return Shipping Options should be included. By default all + Shipping Options are returned. + schema: + type: boolean + - in: query + name: product_ids + description: A comma separated list of Product ids to filter Shipping Options by. + schema: + type: string + - in: query + name: region_id + description: the Region to retrieve Shipping Options from. + 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 }) + + medusa.shippingOptions.list() + + .then(({ shipping_options }) => { + console.log(shipping_options.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/shipping-options' + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_options: + type: array + items: + $ref: '#/components/schemas/shipping_option' + '400': + $ref: '#/components/responses/400_error' + '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/{cart_id}': + get: + operationId: GetShippingOptionsCartId + summary: Retrieve Shipping Options for Cart + description: Retrieves a list of Shipping Options available to a cart. + parameters: + - in: path + name: cart_id + required: true + description: The id of the Cart. + 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 }) + + medusa.shippingOptions.listCartOptions(cart_id) + + .then(({ shipping_options }) => { + console.log(shipping_options.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/shipping-options/{cart_id}' + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_options: + type: array + items: + $ref: '#/components/schemas/shipping_option' + '400': + $ref: '#/components/responses/400_error' + '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: + post: + operationId: PostSwaps + summary: Create a Swap + description: >- + Creates a Swap on an Order by providing some items to return along with + some items to send back + requestBody: + content: + application/json: + schema: + required: + - order_id + - return_items + - additional_items + properties: + order_id: + type: string + description: The ID of the Order to create the Swap for. + return_items: + description: The items to include in the Return. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item from the Order. + type: string + quantity: + description: The quantity to swap. + type: integer + reason_id: + description: The ID of the reason of this return. + type: string + note: + description: The note to add to the item being swapped. + type: string + return_shipping_option: + type: string + description: >- + The ID of the Shipping Option to create the Shipping Method + from. + additional_items: + description: The items to exchange the returned items to. + type: array + items: + required: + - variant_id + - quantity + properties: + variant_id: + description: The ID of the Product Variant to send. + type: string + quantity: + description: The quantity to send of the variant. + type: integer + 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.swaps.create({ + order_id, + return_items: [ { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - }, - { - "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": "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": "type", - "description": "type to search for.", - "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": "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": 100 - } - }, - { - "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" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - } - } - } - } - } - }, - "/products/search": { - "get": { - "operationId": "GetProductsSearch", - "summary": "Search Products", - "description": "Run a search query on products using the search engine installed on Medusa", - "parameters": [ - { - "in": "query", - "name": "q", - "required": true, - "description": "The query to run the search with.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "offset", - "description": "How many products to skip in the result.", - "schema": { - "type": "integer" - } - }, - { - "in": "query", - "name": "limit", - "description": "Limit the number of products returned.", - "schema": { - "type": "integer" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "hits": { - "type": "array", - "description": "Array of results. The format of the items depends on the search engine installed on the server." - } - } - } - } - } - } - } - } - }, - "/regions/{id}": { - "get": { - "operationId": "GetRegionsRegion", - "summary": "Retrieves a Region", - "description": "Retrieves a Region.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Region.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - }, - "/regions": { - "get": { - "operationId": "GetRegions", - "summary": "List Regions", - "description": "Retrieves a list of Regions.", - "parameters": [ - { - "in": "query", - "name": "offset", - "description": "How many regions to skip in the result.", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "in": "query", - "name": "limit", - "description": "Limit the number of regions returned.", - "schema": { - "type": "integer", - "default": 100 - } - }, - { - "in": "query", - "name": "created_at", - "description": "Date comparison for when resulting regions 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 regions 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" - } - } - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "regions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - } - }, - "/return-reasons/{id}": { - "get": { - "operationId": "GetReturnReasonsReason", - "summary": "Retrieve a Return Reason", - "description": "Retrieves a Return Reason.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Return Reason.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reason": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - } - }, - "/return-reasons": { - "get": { - "operationId": "GetReturnReasons", - "summary": "List Return Reasons", - "description": "Retrieves a list of Return Reasons.", - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reasons": { - "type": "array", - "items": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - } - } - }, - "/returns": { - "post": { - "operationId": "PostReturns", - "summary": "Create Return", - "description": "Creates a Return for an Order.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "order_id", - "items" - ], - "properties": { - "order_id": { - "type": "string", - "description": "The ID of the Order to create the Return from." - }, - "items": { - "description": "The items to include in the Return.", - "type": "array", - "items": { - "required": [ - "item_id", - "quantity" - ], - "properties": { - "item_id": { - "description": "The ID of the Line Item from the Order.", - "type": "string" - }, - "quantity": { - "description": "The quantity to return.", - "type": "integer" - }, - "reason_id": { - "description": "The ID of the return reason.", - "type": "string" - }, - "note": { - "description": "A note to add to the item returned.", - "type": "string" - } - } - } - }, - "return_shipping": { - "description": "If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves.", - "type": "object", - "required": [ - "option_id" - ], - "properties": { - "option_id": { - "type": "string", - "description": "The ID of the Shipping Option to create the Shipping Method from." - } - } - } - } - } - } - } - }, - "tags": [ - "Return" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return": { - "$ref": "#/components/schemas/return" - } - } - } - } - } - } - } - } - }, - "/shipping-options": { - "get": { - "operationId": "GetShippingOptions", - "summary": "Retrieve Shipping Options", - "description": "Retrieves a list of Shipping Options.", - "parameters": [ - { - "in": "query", - "name": "is_return", - "description": "Whether return Shipping Options should be included. By default all Shipping Options are returned.", - "schema": { - "type": "boolean" - } - }, - { - "in": "query", - "name": "product_ids", - "description": "A comma separated list of Product ids to filter Shipping Options by.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "region_id", - "description": "the Region to retrieve Shipping Options from.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Shipping Option" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_options": { - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_option" - } - } - } - } - } - } - } - } - } - }, - "/shipping-options/{cart_id}": { - "get": { - "operationId": "GetShippingOptionsCartId", - "summary": "Retrieve Shipping Options for Cart", - "description": "Retrieves a list of Shipping Options available to a cart.", - "parameters": [ - { - "in": "path", - "name": "cart_id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Shipping Option" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_options": { - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_option" - } - } - } - } - } - } - } - } - } - }, - "/swaps": { - "post": { - "operationId": "PostSwaps", - "summary": "Create a Swap", - "description": "Creates a Swap on an Order by providing some items to return along with some items to send back", - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "order_id", - "return_items", - "additional_items" - ], - "properties": { - "order_id": { - "type": "string", - "description": "The ID of the Order to create the Swap for." - }, - "return_items": { - "description": "The items to include in the Return.", - "type": "array", - "items": { - "required": [ - "item_id", - "quantity" - ], - "properties": { - "item_id": { - "description": "The ID of the Line Item from the Order.", - "type": "string" - }, - "quantity": { - "description": "The quantity to swap.", - "type": "integer" - }, - "reason_id": { - "description": "The ID of the reason of this return.", - "type": "string" - }, - "note": { - "description": "The note to add to the item being swapped.", - "type": "string" - } - } - } - }, - "return_shipping_option": { - "type": "string", - "description": "The ID of the Shipping Option to create the Shipping Method from." - }, - "additional_items": { - "description": "The items to exchange the returned items to.", - "type": "array", - "items": { - "required": [ - "variant_id", - "quantity" - ], - "properties": { - "variant_id": { - "description": "The ID of the Product Variant to send.", - "type": "string" - }, - "quantity": { - "description": "The quantity to send of the variant.", - "type": "integer" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "swap": { - "$ref": "#/components/schemas/swap" - } - } - } - } - } - } - } - } - }, - "/swaps/{cart_id}": { - "get": { - "operationId": "GetSwapsSwapCartId", - "summary": "Retrieve Swap by Cart id", - "description": "Retrieves a Swap by the id of the Cart used to confirm the Swap.", - "parameters": [ - { - "in": "path", - "name": "cart_id", - "required": true, - "description": "The id of the Cart", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "swap": { - "$ref": "#/components/schemas/swap" - } - } - } - } - } - } - } - } - }, - "/variants/{variant_id}": { - "get": { - "operationId": "GetVariantsVariant", - "summary": "Retrieve a Product Variant", - "description": "Retrieves a Product Variant by id", - "parameters": [ - { - "in": "path", - "name": "variant_id", - "required": true, - "description": "The id of the Product Variant.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "cart_id", - "description": "The id of the Cart to set prices based on.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "region_id", - "description": "The id of the Region to set prices based on.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "currency_code", - "style": "form", - "explode": false, - "description": "The 3 character ISO currency code to set prices based on.", - "schema": { - "type": "string", - "externalDocs": { - "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", - "description": "See a list of codes." - } - } - } - ], - "tags": [ - "Product Variant" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "variant": { - "$ref": "#/components/schemas/product_variant" - } - } - } - } - } - } - } - } - }, - "/variants": { - "get": { - "operationId": "GetVariants", - "summary": "Retrieve Product Variants", - "description": "Retrieves a list of Product Variants", - "parameters": [ - { - "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": "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": "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" - } - } - } - ] - } - } - ], - "tags": [ - "Product Variant" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "variants": { - "type": "array", - "items": { - "$ref": "#/components/schemas/product_variant" - } - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "address": { - "title": "Address", - "description": "An address.", - "x-resourceId": "address", - "properties": { - "id": { - "type": "string", - "description": "ID of the address", - "example": "addr_01G8ZC9VS1XVE149MGH2J7QSSH" - }, - "customer_id": { - "type": "string", - "description": "ID of the customer this address belongs to", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "Available if the relation `customer` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A customer object." - } - }, - "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" - }, - "country": { - "description": "A country object. Available if the relation `country` is expanded.", - "type": "object" - }, - "province": { - "type": "string", - "description": "Province", - "example": "Kentucky" - }, - "postal_code": { - "type": "string", - "description": "Postal Code", - "example": 72093 - }, - "phone": { - "type": "string", - "description": "Phone Number", - "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": { - "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" - } - } - } - }, - "batch_job": { - "title": "Batch Job", - "description": "A Batch Job.", - "x-resourceId": "batch_job", - "required": [ - "type" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique identifier for the batch job.", - "example": "batch_01G8T782965PYFG0751G0Z38B4" - }, - "type": { - "type": "string", - "description": "The type of batch job.", - "enum": [ - "product-import", - "product-export" - ] - }, - "status": { - "type": "string", - "description": "The status of the batch job.", - "enum": [ - "created", - "pre_processed", - "confirmed", - "processing", - "completed", - "canceled", - "failed" - ], - "default": "created" - }, - "created_by": { - "type": "string", - "description": "The unique identifier of the user that created the batch job.", - "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" - }, - "created_by_user": { - "description": "A user object. Available if the relation `created_by_user` is expanded.", - "type": "object" - }, - "context": { - "type": "object", - "description": "The context of the batch job, the type of the batch job determines what the context should contain.", - "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": "Specify if the job must apply the modifications or not.", - "default": false - }, - "result": { - "type": "object", - "description": "The result of the batch job.", - "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." + item_id, + quantity: 1 } ], - "stat_descriptors": [ + additional_items: [ { - "key": "product-export-count", - "name": "Product count to export", - "message": "There will be 8 products exported by this action" + variant_id, + quantity: 1 } ] - } - }, - "pre_processed_at": { - "type": "string", - "description": "The date from which the job has been pre processed.", - "format": "date-time" - }, - "processing_at": { - "type": "string", - "description": "The date the job is processing at.", - "format": "date-time" - }, - "confirmed_at": { - "type": "string", - "description": "The date when the confirmation has been done.", - "format": "date-time" - }, - "completed_at": { - "type": "string", - "description": "The date of the completion.", - "format": "date-time" - }, - "canceled_at": { - "type": "string", - "description": "The date of the concellation.", - "format": "date-time" - }, - "failed_at": { - "type": "string", - "description": "The date when the job failed.", - "format": "date-time" - }, - "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 last updated.", - "format": "date-time" - }, - "deleted_at": { - "type": "string", - "description": "The date with timezone at which the resource was deleted.", - "format": "date-time" - } - } - }, - "cart": { - "title": "Cart", - "description": "Represents a user cart", - "x-resourceId": "cart", - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "email": { - "type": "string", - "description": "The email associated with the cart", - "format": "email" - }, - "billing_address_id": { - "type": "string", - "description": "The billing address's ID", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "billing_address": { - "description": "Available if the relation `billing_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_address_id": { - "type": "string", - "description": "The shipping address's ID", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "items": { - "description": "Available if the relation `items` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "region_id": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "discounts": { - "type": "array", - "description": "Available if the relation `discounts` is expanded.", - "items": { - "type": "object", - "description": "A discount object." - } - }, - "gift_cards": { - "type": "array", - "description": "Available if the relation `gift_cards` is expanded.", - "items": { - "type": "object", - "description": "A gift card object." - } - }, - "customer_id": { - "type": "string", - "description": "The customer's ID", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "payment_session": { - "description": "The selected payment session in the cart.", - "$ref": "#/components/schemas/payment_session" - }, - "payment_sessions": { - "type": "array", - "description": "The payment sessions created on the cart.", - "items": { - "$ref": "#/components/schemas/payment_session" - } - }, - "payment_id": { - "type": "string", - "description": "The payment's ID if available", - "example": "pay_01G8ZCC5W42ZNY842124G7P5R9" - }, - "payment": { - "description": "Available if the relation `payment` is expanded.", - "$ref": "#/components/schemas/payment" - }, - "shipping_methods": { - "type": "array", - "description": "The shipping methods added to the cart.", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "type": { - "type": "string", - "description": "The cart's type.", - "enum": [ - "default", - "swap", - "draft_order", - "payment_link", - "claim" - ], - "default": "default" - }, - "completed_at": { - "type": "string", - "description": "The date with timezone at which the cart was completed.", - "format": "date-time" - }, - "payment_authorized_at": { - "type": "string", - "description": "The date with timezone at which the payment was authorized.", - "format": "date-time" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a cart in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "context": { - "type": "object", - "description": "The context of the cart which can include info like IP or user agent.", - "example": { - "ip": "::1", - "user_agent": "PostmanRuntime/7.29.2" - } - }, - "sales_channel_id": { - "type": "string", - "description": "The sales channel ID the cart is associated with.", - "example": null - }, - "sales_channel": { - "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", - "type": "object" - }, - "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" - } - }, - "shipping_total": { - "type": "integer", - "description": "The total of shipping", - "example": 1000 - }, - "discount_total": { - "type": "integer", - "description": "The total of discount", - "example": 800 - }, - "tax_total": { - "type": "integer", - "description": "The total of tax", - "example": 0 - }, - "refunded_total": { - "type": "integer", - "description": "The total amount refunded if the order associated with this cart is returned.", - "example": 0 - }, - "total": { - "type": "integer", - "description": "The total amount of the cart", - "example": 8200 - }, - "subtotal": { - "type": "integer", - "description": "The subtotal of the cart", - "example": 8000 - }, - "refundable_amount": { - "type": "integer", - "description": "The amount that can be refunded", - "example": 8200 - }, - "gift_card_total": { - "type": "integer", - "description": "The total of gift cards", - "example": 0 - }, - "gift_card_tax_total": { - "type": "integer", - "description": "The total of gift cards with taxes", - "example": 0 - } - } - }, - "claim_image": { - "title": "Claim Image", - "description": "Represents photo documentation of a claim.", - "x-resourceId": "claim_image", - "required": [ - "claim_item_id", - "url" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim image's ID", - "example": "cimg_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "claim_item_id": { - "type": "string", - "description": "The ID of the claim item associated with the image" - }, - "claim_item": { - "description": "A claim item object. Available if the relation `claim_item` is expanded.", - "type": "object" - }, - "url": { - "type": "string", - "description": "The URL of the image", - "format": "uri" - }, - "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" - } - } - } - }, - "claim_item": { - "title": "Claim Item", - "description": "Represents a claimed item along with information about the reasons for the claim.", - "x-resourceId": "claim_item", - "required": [ - "claim_order_id", - "item_id", - "variant_id", - "reason", - "quantity" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim item's ID", - "example": "citm_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "images": { - "type": "array", - "description": "Available if the relation `images` is expanded.", - "items": { - "$ref": "#/components/schemas/claim_image" - } - }, - "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.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/line_item" - }, - "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.", - "type": "object" - }, - "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", - "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/claim_tag" - } - }, - "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" - } - } - } - }, - "claim_order": { - "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.", - "x-resourceId": "claim_order", - "required": [ - "type", - "order_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim's ID", - "example": "claim_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "type": { - "type": "string", - "enum": [ - "refund", - "replace" - ] - }, - "payment_status": { - "type": "string", - "description": "The status of the claim's payment", - "enum": [ - "na", - "not_refunded", - "refunded" - ], - "default": "na" - }, - "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/claim_item" - } - }, - "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/line_item" - } - }, - "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.", - "type": "object" - }, - "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", - "type": "object" - }, - "shipping_address_id": { - "description": "The ID of the address that the new items should be shipped to", - "type": "string", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_methods": { - "description": "The shipping methods that the claim order will be shipped with.", - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "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", - "type": "integer", - "example": 1000 - }, - "canceled_at": { - "description": "The date with timezone at which the claim was canceled.", - "type": "string", - "format": "date-time" - }, - "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" - } - }, - "no_notification": { - "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the cart associated with the claim in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - } - } - }, - "claim_tag": { - "title": "Claim Tag", - "description": "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping.", - "x-resourceId": "claim_tag", - "required": [ - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The claim tag's ID", - "example": "ctag_01G8ZCC5Y63B95V6B5SHBZ91S4" - }, - "value": { - "description": "The value that the claim tag holds", - "type": "string", - "example": "Damaged" - }, - "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" - } - } - } - }, - "country": { - "title": "Country", - "description": "Country details", - "x-resourceId": "country", - "required": [ - "iso_2", - "iso_3", - "num_code", - "name", - "display_name" - ], - "properties": { - "id": { - "type": "string", - "description": "The country's ID", - "example": 109 - }, - "iso_2": { - "type": "string", - "description": "The 2 character ISO code of the country in lower case", - "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": { - "type": "string", - "description": "The 2 character ISO code of the country in lower case", - "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": { - "type": "string", - "description": "The region ID this country is associated with.", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - } - } - }, - "currency": { - "title": "Currency", - "description": "Currency", - "x-resourceId": "currency", - "required": [ - "code", - "symbol", - "symbol_native", - "name" - ], - "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" - } - } - }, - "custom_shipping_option": { - "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", - "x-resourceId": "custom_shipping_option", - "required": [ - "price", - "shipping_option_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The custom shipping option's ID", - "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.", - "type": "object" - }, - "cart_id": { - "description": "The ID of the Cart that the custom shipping option is attached to", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "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" - } - } - } - }, - "customer_group": { - "title": "Customer Group", - "description": "Represents a customer group", - "x-resourceId": "customer_group", - "required": [ - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The customer group's ID", - "example": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "name": { - "type": "string", - "description": "The name of the customer group", - "example": "VIP" - }, - "customers": { - "type": "array", - "description": "The customers that belong to the customer group. Available if the relation `customers` is expanded.", - "items": { - "type": "object", - "description": "A customer object." - } - }, - "price_lists": { - "type": "array", - "description": "The price lists that are associated with the customer group. Available if the relation `price_lists` is expanded.", - "items": { - "$ref": "#/components/schemas/price_list" - } - }, - "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" - } - } - } - }, - "customer": { - "title": "Customer", - "description": "Represents a customer", - "x-resourceId": "customer", - "required": [ - "email" - ], - "properties": { - "id": { - "type": "string", - "description": "The customer's ID", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "email": { - "type": "string", - "description": "The customer's email", - "format": "email" - }, - "first_name": { - "type": "string", - "description": "The customer's first name", - "example": "Arno" - }, - "last_name": { - "type": "string", - "description": "The customer's first name", - "example": "Willms" - }, - "billing_address_id": { - "type": "string", - "description": "The customer's billing address ID", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "billing_address": { - "description": "Available if the relation `billing_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_addresses": { - "description": "Available if the relation `shipping_addresses` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/address" - } - }, - "phone": { - "type": "string", - "description": "The customer's phone number", - "example": 16128234334802 - }, - "has_account": { - "type": "boolean", - "description": "Whether the customer has an account or not", - "default": false - }, - "orders": { - "description": "Available if the relation `orders` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "An order object." - } - }, - "groups": { - "description": "The customer groups the customer belongs to. Available if the relation `groups` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/customer_group" - } - }, - "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" - } - } - } - }, - "discount_condition_customer_group": { - "title": "Product Tag Discount Condition", - "description": "Associates a discount condition with a customer group", - "x-resourceId": "discount_condition_customer_group", - "required": [ - "customer_group_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/customer_group" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product_collection": { - "title": "Product Collection Discount Condition", - "description": "Associates a discount condition with a product collection", - "x-resourceId": "discount_condition_product_collection", - "required": [ - "product_collection_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product_collection" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product_tag": { - "title": "Product Tag Discount Condition", - "description": "Associates a discount condition with a product tag", - "x-resourceId": "discount_condition_product_tag", - "required": [ - "product_tag_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product_tag" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product_type": { - "title": "Product Type Discount Condition", - "description": "Associates a discount condition with a product type", - "x-resourceId": "discount_condition_product", - "required": [ - "product_type_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product_type" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition_product": { - "title": "Product Discount Condition", - "description": "Associates a discount condition with a product", - "x-resourceId": "discount_condition_product", - "required": [ - "product_id", - "condition_id" - ], - "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.", - "$ref": "#/components/schemas/product" - }, - "discount_condition": { - "description": "Available if the relation `discount_condition` is expanded.", - "$ref": "#/components/schemas/discount_condition" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "discount_condition": { - "title": "Discount Condition", - "description": "Holds rule conditions for when a discount is applicable", - "x-resourceId": "discount_condition", - "required": [ - "type", - "operator", - "discount_rule_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The discount condition's ID", - "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": { - "type": "string", - "description": "The ID of the discount rule associated with the condition", - "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" - }, - "discount_rule": { - "description": "Available if the relation `discount_rule` is expanded.", - "$ref": "#/components/schemas/discount_rule" - }, - "products": { - "description": "products associated with this condition if type = products. Available if the relation `products` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product object." - } - }, - "product_types": { - "description": "product types associated with this condition if type = product_types. Available if the relation `product_types` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product type object." - } - }, - "product_tags": { - "description": "product tags associated with this condition if type = product_tags. Available if the relation `product_tags` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product tag object." - } - }, - "product_collections": { - "description": "product collections associated with this condition if type = product_collections. Available if the relation `product_collections` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product collection object." - } - }, - "customer_groups": { - "description": "customer groups associated with this condition if type = customer_groups. Available if the relation `customer_groups` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A customer group object." - } - }, - "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" - } - } - } - }, - "discount_rule": { - "title": "Discount Rule", - "description": "Holds the rules that governs how a Discount is calculated when applied to a Cart.", - "x-resourceId": "discount_rule", - "required": [ - "type", - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The discount rule's ID", - "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", - "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.", - "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": { - "type": "object", - "description": "A discount condition object." - } - }, - "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" - } - } - } - }, - "discount": { - "title": "Discount", - "description": "Represents a discount that can be applied to a cart for promotional purposes.", - "x-resourceId": "discount", - "required": [ - "code", - "is_dynamic" - ], - "properties": { - "id": { - "type": "string", - "description": "The discount's ID", - "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": { - "type": "string", - "description": "The Discount Rule that governs the behaviour of the Discount", - "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" - }, - "rule": { - "description": "Available if the relation `rule` is expanded.", - "$ref": "#/components/schemas/discount_rule" - }, - "is_disabled": { - "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts", - "type": "boolean", - "example": false - }, - "parent_discount_id": { - "type": "string", - "description": "The Discount that the discount was created from. This will always be a dynamic discount", - "example": "disc_01G8ZH853YPY9B94857DY91YGW" - }, - "parent_discount": { - "description": "Available if the relation `parent_discount` is expanded.", - "$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.", - "type": "string", - "format": "date-time" - }, - "valid_duration": { - "type": "string", - "description": "Duration the discount runs between", - "example": "P3Y6M4DT12H30M5S" - }, - "regions": { - "description": "The Regions in which the Discount can be used. Available if the relation `regions` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A region object." - } - }, - "usage_limit": { - "description": "The maximum number of times that a discount can be used.", - "type": "integer", - "example": 100 - }, - "usage_count": { - "description": "The number of times a discount has been used.", - "type": "integer", - "example": 50, - "default": 0 - }, - "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" - } - } - } - }, - "draft-order": { - "title": "DraftOrder", - "description": "Represents a draft order", - "x-resourceId": "draft-order", - "properties": { - "id": { - "type": "string", - "description": "The draft order's ID", - "example": "dorder_01G8TJFKBG38YYFQ035MSVG03C" - }, - "status": { - "type": "string", - "description": "The status of the draft order", - "enum": [ - "open", - "completed" - ], - "default": "open" - }, - "display_id": { - "type": "string", - "description": "The draft order's display ID", - "example": 2 - }, - "cart_id": { - "type": "string", - "description": "The ID of the cart associated with the draft order.", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "order_id": { - "type": "string", - "description": "The ID of the order associated with the draft order.", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "canceled_at": { - "type": "string", - "description": "The date the draft order was canceled at.", - "format": "date-time" - }, - "completed_at": { - "type": "string", - "description": "The date the draft order was completed at.", - "format": "date-time" - }, - "no_notification_order": { - "type": "boolean", - "description": "Whether to send the customer notifications regarding order updates.", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "fulfillment_item": { - "title": "Fulfillment Item", - "description": "Correlates a Line Item with a Fulfillment, keeping track of the quantity of the Line Item.", - "x-resourceId": "fulfillment_item", - "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.", - "type": "object" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "quantity": { - "description": "The quantity of the Line Item that is included in the Fulfillment.", - "type": "integer", - "example": 1 - } - } - }, - "fulfillment_provider": { - "title": "Fulfillment Provider", - "description": "Represents a fulfillment provider plugin and holds its installation status.", - "x-resourceId": "fulfillment_provider", - "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", - "example": 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.", - "x-resourceId": "fulfillment", - "required": [ - "provider_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" - }, - "claim_order_id": { - "description": "The id of the Claim that the Fulfillment belongs to.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "swap_id": { - "description": "The id of the Swap that the Fulfillment belongs to.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The id of the Order that the Fulfillment belongs to.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/fulfillment_provider" - }, - "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/fulfillment_item" - } - }, - "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/tracking_link" - } - }, - "tracking_numbers": { - "deprecated": true, - "description": "The tracking numbers that can be used to track the status of the fulfillment.", - "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.", - "type": "string", - "format": "date-time" - }, - "no_notification": { - "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean", - "example": false - }, - "canceled_at": { - "description": "The date with timezone at which the Fulfillment was canceled.", - "type": "string", - "format": "date-time" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the fulfillment in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "gift_card_transaction": { - "title": "Gift Card Transaction", - "description": "Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order", - "x-resourceId": "gift_card_transaction", - "required": [ - "gift_card_id", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The gift card transaction's ID", - "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.", - "type": "object" - }, - "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.", - "type": "object" - }, - "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.", - "type": "boolean", - "example": false - }, - "tax_rate": { - "description": "The tax rate of the transaction", - "type": "number", - "example": 0 - } - } - }, - "gift_card": { - "title": "Gift Card", - "description": "Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.", - "x-resourceId": "gift_card", - "required": [ - "code", - "value", - "balance", - "region_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "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": { - "type": "string", - "description": "The id of the Region in which the Gift Card is available.", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "order_id": { - "type": "string", - "description": "The id of the Order that the Gift Card was purchased in.", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "is_disabled": { - "description": "Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts.", - "type": "boolean", - "example": false - }, - "ends_at": { - "description": "The time at which the Gift Card can no longer be used.", - "type": "string", - "format": "date-time" - }, - "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" - } - } - } - }, - "idempotency_key": { - "title": "Idempotency Key", - "description": "Idempotency Key is used to continue a process in case of any failure that might occur.", - "x-resourceId": "idempotency_key", - "required": [ - "idempotency_key" - ], - "properties": { - "id": { - "type": "string", - "description": "The idempotency key's ID", - "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.", - "type": "string", - "format": "date-time" - }, - "request_method": { - "description": "The method of the request", - "type": "string", - "example": "POST" - }, - "request_params": { - "type": "object", - "description": "The parameters passed to the request", - "example": { - "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - } - }, - "request_path": { - "description": "The request's path", - "type": "string", - "example": "/store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete" - }, - "response_code": { - "type": "string", - "description": "The response's code.", - "example": 200 - }, - "response_body": { - "type": "object", - "description": "The response's body", - "example": { - "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - } - }, - "recovery_point": { - "type": "string", - "description": "Where to continue from.", - "default": "started" - } - } - }, - "image": { - "title": "Image", - "description": "Images holds a reference to a URL at which the image file can be found.", - "x-resourceId": "image", - "required": [ - "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": { - "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" - } - } - } - }, - "invite": { - "title": "Invite", - "description": "Represents an invite", - "x-resourceId": "invite", - "required": [ - "user_email" - ], - "properties": { - "id": { - "type": "string", - "description": "The invite's ID", - "example": "invite_01G8TKE4XYCTHSCK2GDEP47RE1" - }, - "user_email": { - "type": "string", - "description": "The email of the user being invited.", - "format": "email" - }, - "role": { - "type": "string", - "description": "The user's role.", - "enum": [ - "admin", - "member", - "developer" - ], - "default": "member" - }, - "accepted": { - "type": "boolean", - "description": "Whether the invite was accepted or not.", - "example": false - }, - "token": { - "type": "string", - "description": "The token used to accept the invite." - }, - "expores_at": { - "type": "string", - "description": "The date the invite expires at.", - "format": "date-time" - }, - "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" - } - } - } - }, - "line_item_adjustment": { - "title": "Line Item Adjustment", - "description": "Represents an Line Item Adjustment", - "x-resourceId": "line_item_adjustment", - "required": [ - "item_id", - "description", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The invite's ID", - "example": "lia_01G8TKE4XYCTHSCK2GDEP47RE1" - }, - "item_id": { - "type": "string", - "description": "The ID of the line item", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "description": { - "type": "string", - "description": "The line item's adjustment description", - "example": "Adjusted item's price." - }, - "discount_id": { - "type": "string", - "description": "The ID of the discount associated with the adjustment", - "example": "disc_01F0YESMW10MGHWJKZSDDMN0VN" - }, - "discount": { - "description": "Available if the relation `discount` is expanded.", - "$ref": "#/components/schemas/discount" - }, - "amount": { - "type": "number", - "description": "The adjustment amount", - "example": 1000 - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "line_item_tax_line": { - "title": "Line Item Tax Line", - "description": "Represents an Line Item Tax Line", - "x-resourceId": "line_item_tax_line", - "required": [ - "item_id", - "rate", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The line item tax line's ID", - "example": "litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" - }, - "item_id": { - "type": "string", - "description": "The ID of the line item", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "code": { - "description": "A code to identify the tax type by", - "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": { - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "line_item": { - "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.", - "x-resourceId": "line_item", - "required": [ - "title", - "unit_price", - "quantity" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "cart_id": { - "description": "The ID of the Cart that the Line Item belongs to.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The ID of the Order that the Line Item belongs to.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "swap_id": { - "description": "The id of the Swap that the Line Item belongs to.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "claim_order_id": { - "description": "The id of the Claim that the Line Item belongs to.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "tax_lines": { - "description": "Available if the relation `tax_lines` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item_tax_line" - } - }, - "adjustments": { - "description": "Available if the relation `adjustments` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item_adjustment" - } - }, - "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.", - "type": "string", - "example": "One Size" - }, - "thumbnail": { - "description": "A URL string to a small image of the contents of the Line Item.", - "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", - "example": false - }, - "is_giftcard": { - "description": "Flag to indicate if the Line Item is a Gift Card.", - "type": "boolean", - "example": 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", - "example": false - }, - "allow_discounts": { - "description": "Flag to indicate if the Line Item should be included when doing discount calculations.", - "type": "boolean", - "example": false - }, - "has_shipping": { - "description": "Flag to indicate if the Line Item has fulfillment associated with it.", - "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": "boolean", - "example": 8000 - }, - "variant_id": { - "description": "The id of the Product Variant contained in the Line Item.", - "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.", - "type": "object" - }, - "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.", - "type": "integer", - "example": 0 - }, - "returned_quantity": { - "description": "The quantity of the Line Item that has been returned.", - "type": "integer", - "example": 0 - }, - "shipped_quantity": { - "description": "The quantity of the Line Item that has been shipped.", - "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": { - "type": "integer", - "description": "The subtotal of the line item", - "example": 8000 - }, - "tax_total": { - "type": "integer", - "description": "The total of tax of the line item", - "example": 0 - }, - "total": { - "type": "integer", - "description": "The total amount of the line item", - "example": 8000 - }, - "original_total": { - "type": "integer", - "description": "The original total amount of the line item", - "example": 8000 - }, - "original_tax_total": { - "type": "integer", - "description": "The original tax total amount of the line item", - "example": 0 - }, - "discount_total": { - "type": "integer", - "description": "The total of discount of the line item", - "example": 0 - }, - "gift_card_total": { - "type": "integer", - "description": "The total of the gift card of the line item", - "example": 0 - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "money_amount": { - "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.", - "x-resourceId": "money_amount", - "required": [ - "currency_code", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The money amount's ID", - "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.", - "$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.", - "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.", - "type": "integer", - "example": 1 - }, - "price_list_id": { - "type": "string", - "description": "The ID of the price list associated with the money amount", - "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" - }, - "price_list": { - "description": "Available if the relation `price_list` is expanded.", - "$ref": "#/components/schemas/price_list" - }, - "variant_id": { - "description": "The id of the Product Variant contained in the Line Item.", - "type": "string", - "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" - }, - "variant": { - "description": "The Product Variant contained in the Line Item. Available if the relation `variant` is expanded.", - "type": "object" - }, - "region_id": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "note", - "required": [ - "value", - "resource_type", - "resource_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The note's ID", - "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": { - "type": "string", - "description": "The ID of the author (user)", - "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" - }, - "author": { - "description": "Available if the relation `author` is expanded.", - "$ref": "#/components/schemas/user" - }, - "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" - } - } - } - }, - "notification_provider": { - "title": "Notification Provider", - "description": "Represents a notification provider plugin and holds its installation status.", - "x-resourceId": "notification_provider", - "required": [ - "id" - ], - "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.", - "x-resourceId": "notification", - "required": [ - "resource_type", - "resource_id", - "to" - ], - "properties": { - "id": { - "type": "string", - "description": "The notification's ID", - "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" - }, - "event_name": { - "description": "The name of the event that the notification was sent for.", - "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.", - "type": "string", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "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": {} - }, - "resends": { - "description": "The resends that have been completed after the original Notification.", - "type": "array", - "items": { - "$ref": "#/components/schemas/notification_resend" - } - }, - "provider_id": { - "description": "The id of the Notification Provider that handles the Notification.", - "type": "string", - "example": "sengrid" - }, - "provider": { - "description": "Available if the relation `provider` is expanded.", - "$ref": "#/components/schemas/notification_provider" - }, - "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" - } - } - }, - "notification_resend": { - "title": "Notification Resend", - "description": "A resend of a Notification.", - "x-resourceId": "notification_resend", - "properties": { - "id": { - "description": "The notification resend's ID", - "type": "string", - "example": "noti_01F0YET45G9NHP08Z66CE4QKBS" - }, - "event_name": { - "description": "The name of the event that the notification was sent for.", - "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.", - "type": "string", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "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 ID of the Notification that was originally sent.", - "type": "string", - "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" - }, - "parent_notification": { - "description": "Available if the relation `parent_notification` is expanded.", - "$ref": "#/components/schemas/notification" - }, - "provider_id": { - "description": "The ID of the Notification Provider that handles the Notification.", - "type": "string", - "example": "sengrid" - }, - "provider": { - "description": "Available if the relation `provider` is expanded.", - "$ref": "#/components/schemas/notification_provider" - }, - "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" - } - } - }, - "OAuth": { - "title": "OAuth", - "description": "Represent an OAuth app", - "x-resourceId": "OAuth", - "required": [ - "id", - "display_name", - "application_name" - ], - "properties": { - "id": { - "type": "string", - "description": "The app's ID", - "example": "example_app" - }, - "display_name": { - "type": "string", - "description": "The app's display name", - "example": "Example app" - }, - "application_name": { - "type": "string", - "description": "The app's name", - "example": "example" - }, - "install_url": { - "type": "string", - "description": "The URL to install the app", - "format": "uri" - }, - "uninstall_url": { - "type": "string", - "description": "The URL to uninstall the app", - "format": "uri" - }, - "data": { - "type": "object", - "description": "Any data necessary to the app.", - "example": {} - } - } - }, - "order": { - "title": "Order", - "description": "Represents an order", - "x-resourceId": "order", - "required": [ - "customer_id", - "email", - "region_id", - "currency_code" - ], - "properties": { - "id": { - "type": "string", - "description": "The order's ID", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "status": { - "type": "string", - "description": "The order's status", - "enum": [ - "pending", - "completed", - "archived", - "canceled", - "requires_action" - ], - "default": "pending" - }, - "fulfillment_status": { - "type": "string", - "description": "The order's fulfillment status", - "enum": [ - "not_fulfilled", - "partially_fulfilled", - "fulfilled", - "partially_shipped", - "shipped", - "partially_returned", - "returned", - "canceled", - "requires_action" - ], - "default": "not_fulfilled" - }, - "payment_status": { - "type": "string", - "description": "The order's payment status", - "enum": [ - "not_paid", - "awaiting", - "captured", - "partially_refunded", - "refuneded", - "canceled", - "requires_action" - ], - "default": "not_paid" - }, - "display_id": { - "type": "integer", - "description": "The order's display ID", - "example": 2 - }, - "cart_id": { - "type": "string", - "description": "The ID of the cart associated with the order", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "customer_id": { - "type": "string", - "description": "The ID of the customer associated with the order", - "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" - }, - "customer": { - "description": "A customer object. Available if the relation `customer` is expanded.", - "type": "object" - }, - "email": { - "description": "The email associated with the order", - "type": "string", - "format": "email" - }, - "billing_address_id": { - "type": "string", - "description": "The ID of the billing address associated with the order", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "billing_address": { - "description": "Available if the relation `billing_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_address_id": { - "type": "string", - "description": "The ID of the shipping address associated with the order", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "region_id": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/currency" - }, - "tax_rate": { - "description": "The order's tax rate", - "type": "number", - "example": 0 - }, - "discounts": { - "type": "array", - "description": "The discounts used in the order. Available if the relation `discounts` is expanded.", - "items": { - "type": "object", - "description": "A discount object." - } - }, - "gift_cards": { - "type": "array", - "description": "The gift cards used in the order. Available if the relation `gift_cards` is expanded.", - "items": { - "type": "object", - "description": "A gift card object." - } - }, - "shipping_methods": { - "type": "array", - "description": "The shipping methods used in the order. Available if the relation `shipping_methods` is expanded.", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "payments": { - "type": "array", - "description": "The payments used in the order. Available if the relation `payments` is expanded.", - "items": { - "$ref": "#/components/schemas/payment" - } - }, - "fulfillments": { - "type": "array", - "description": "The fulfillments used in the order. Available if the relation `fulfillments` is expanded.", - "items": { - "$ref": "#/components/schemas/fulfillment" - } - }, - "returns": { - "type": "array", - "description": "The returns associated with the order. Available if the relation `returns` is expanded.", - "items": { - "type": "object", - "description": "A return object." - } - }, - "claims": { - "type": "array", - "description": "The claims associated with the order. Available if the relation `claims` is expanded.", - "items": { - "type": "object", - "description": "A claim order object." - } - }, - "refunds": { - "type": "array", - "description": "The refunds associated with the order. Available if the relation `refunds` is expanded.", - "items": { - "type": "object", - "description": "A refund object." - } - }, - "swaps": { - "type": "array", - "description": "The swaps associated with the order. Available if the relation `swaps` is expanded.", - "items": { - "type": "object", - "description": "A swap object." - } - }, - "draft_order_id": { - "type": "string", - "description": "The ID of the draft order this order is associated with.", - "example": null - }, - "draft_order": { - "description": "A draft order object. Available if the relation `draft_order` is expanded.", - "type": "object" - }, - "items": { - "type": "array", - "description": "The line items that belong to the order. Available if the relation `items` is expanded.", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "gift_card_transactions": { - "type": "array", - "description": "The gift card transactions used in the order. Available if the relation `gift_card_transactions` is expanded.", - "items": { - "$ref": "#/components/schemas/gift_card_transaction" - } - }, - "canceled_at": { - "type": "string", - "description": "The date the order was canceled on.", - "format": "date-time" - }, - "no_notification": { - "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the processing of the order in case of failure.", - "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.", - "type": "string", - "example": null - }, - "sales_channel_id": { - "type": "string", - "description": "The ID of the sales channel this order is associated with.", - "example": null - }, - "sales_channel": { - "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", - "type": "object" - }, - "shipping_total": { - "type": "integer", - "description": "The total of shipping", - "example": 1000 - }, - "discount_total": { - "type": "integer", - "description": "The total of discount", - "example": 800 - }, - "tax_total": { - "type": "integer", - "description": "The total of tax", - "example": 0 - }, - "refunded_total": { - "type": "integer", - "description": "The total amount refunded if the order is returned.", - "example": 0 - }, - "total": { - "type": "integer", - "description": "The total amount of the order", - "example": 8200 - }, - "subtotal": { - "type": "integer", - "description": "The subtotal of the order", - "example": 8000 - }, - "paid_total": { - "type": "integer", - "description": "The total amount paid", - "example": 8000 - }, - "refundable_amount": { - "type": "integer", - "description": "The amount that can be refunded", - "example": 8200 - }, - "gift_card_total": { - "type": "integer", - "description": "The total of gift cards", - "example": 0 - }, - "gift_card_tax_total": { - "type": "integer", - "description": "The total of gift cards with taxes", - "example": 0 - } - } - }, - "payment_provider": { - "title": "Payment Provider", - "description": "Represents a Payment Provider plugin and holds its installation status.", - "x-resourceId": "payment_provider", - "required": [ - "id" - ], - "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 - } - } - }, - "payment_session": { - "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.", - "x-resourceId": "payment_session", - "required": [ - "cart_id", - "provider_id", - "status" - ], - "properties": { - "id": { - "type": "string", - "description": "The payment session's ID", - "example": "ps_01G901XNSRM2YS3ASN9H5KG3FZ" - }, - "cart_id": { - "description": "The id of the Cart that the Payment Session is created for.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "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.", - "type": "boolean", - "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": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a cart in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - }, - "payment": { - "title": "Payment", - "description": "Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded.", - "x-resourceId": "payment", - "required": [ - "amount", - "currency_code", - "provider_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The payment's ID", - "example": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE" - }, - "swap_id": { - "description": "The ID of the Swap that the Payment is used for.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "cart_id": { - "description": "The id of the Cart that the Payment Session is created for.", - "type": "string" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The ID of the Order that the Payment is used for.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/currency" - }, - "amount_refunded": { - "description": "The amount of the original Payment amount that has been refunded back to the Customer.", - "type": "integer", - "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.", - "type": "string", - "format": "date-time" - }, - "canceled_at": { - "description": "The date with timezone at which the Payment was canceled.", - "type": "string", - "format": "date-time" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a payment in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "price_list": { - "title": "Price List", - "description": "Price Lists represents a set of prices that overrides the default price for one or more product variants.", - "x-resourceId": "price_list", - "required": [ - "name", - "description" - ], - "properties": { - "id": { - "type": "string", - "description": "The price list's ID", - "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" - }, - "name": { - "type": "string", - "description": "The price list's name", - "example": "VIP Prices" - }, - "description": { - "type": "string", - "description": "The price list's description", - "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.", - "type": "string", - "format": "date-time" - }, - "ends_at": { - "description": "The date with timezone that the Price List stops being valid.", - "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": { - "type": "object", - "description": "A customer group object." - } - }, - "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/money_amount" - } - }, - "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" - } - } - }, - "product_collection": { - "title": "Product Collection", - "description": "Product Collections represents a group of Products that are related.", - "x-resourceId": "product_collection", - "required": [ - "title" - ], - "properties": { - "id": { - "type": "string", - "description": "The product collection's ID", - "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.", - "type": "string", - "example": "summer-collection" - }, - "products": { - "description": "The Products contained in the Product Collection. Available if the relation `products` is expanded.", - "type": "array", - "items": { - "type": "object", - "description": "A product collection object." - } - }, - "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" - } - } - } - }, - "product_option_value": { - "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.", - "x-resourceId": "product_option_value", - "required": [ - "value", - "option_id", - "variant_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The product option value's ID", - "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.", - "$ref": "#/components/schemas/product_option" - }, - "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.", - "$ref": "#/components/schemas/product_variant" - }, - "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" - } - } - } - }, - "product_option": { - "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.", - "x-resourceId": "product_option", - "required": [ - "title", - "product_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The product option's ID", - "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/product_option_value" - } - }, - "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.", - "type": "object" - }, - "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" - } - } - } - }, - "product_tag": { - "title": "Product Tag", - "description": "Product Tags can be added to Products for easy filtering and grouping.", - "x-resourceId": "product_tag", - "required": [ - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The product tag's ID", - "example": "ptag_01G8K2MTMG9168F2B70S1TAVK3" - }, - "value": { - "description": "The value that the Product Tag represents", - "type": "string", - "example": "Pants" - }, - "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" - } - } - } - }, - "product_tax_rate": { - "title": "Product Tax Rate", - "description": "Associates a tax rate with a product to indicate that the product is taxed in a certain way", - "x-resourceId": "product_tax_rate", - "required": [ - "product_id", - "rate_id" - ], - "properties": { - "product_id": { - "description": "The ID of the Product", - "type": "string", - "example": "prod_01G1G5V2MBA328390B5AXJ610F" - }, - "product": { - "description": "Available if the relation `product` is expanded.", - "$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.", - "$ref": "#/components/schemas/tax_rate" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "product_type_tax_rate": { - "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", - "x-resourceId": "product_type_tax_rate", - "required": [ - "product_type_id", - "rate_id" - ], - "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.", - "$ref": "#/components/schemas/product_type" - }, - "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.", - "$ref": "#/components/schemas/tax_rate" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "product_type": { - "title": "Product Type", - "description": "Product Type can be added to Products for filtering and reporting purposes.", - "x-resourceId": "product_type", - "required": [ - "value" - ], - "properties": { - "id": { - "type": "string", - "description": "The product type's ID", - "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" - }, - "value": { - "description": "The value that the Product Type represents.", - "type": "string", - "example": "Clothing" - }, - "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" - } - } - } - }, - "product_variant": { - "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.", - "x-resourceId": "product_variant", - "required": [ - "title", - "product_id", - "inventory_quantity" - ], - "properties": { - "id": { - "type": "string", - "description": "The product variant's ID", - "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.", - "type": "object" - }, - "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/money_amount" - } - }, - "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.", - "type": "string", - "example": "shirt-123" - }, - "barcode": { - "description": "A generic field for a GTIN number that can be used to identify the Product Variant.", - "type": "string", - "example": null - }, - "ean": { - "description": "An EAN barcode number that can be used to identify the Product Variant.", - "type": "string", - "example": null - }, - "upc": { - "description": "A UPC barcode number that can be used to identify the Product Variant.", - "type": "string", - "example": null - }, - "variant_rank": { - "description": "The ranking of this variant", - "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.", - "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.", - "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.", - "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.", - "type": "string", - "example": null - }, - "weight": { - "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "height": { - "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "width": { - "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "length": { - "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "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/product_option_value" - } - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "product", - "required": [ - "title", - "profile_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The product's ID", - "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.", - "type": "string" - }, - "description": { - "description": "A short description of the Product.", - "type": "string", - "example": "Every programmer's best friend." - }, - "handle": { - "description": "A unique identifier for the Product (e.g. for slug structure).", - "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.", - "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/product_option" - } - }, - "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/product_variant" - } - }, - "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.", - "$ref": "#/components/schemas/shipping_profile" - }, - "weight": { - "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "height": { - "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "width": { - "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "number", - "example": null - }, - "length": { - "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "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.", - "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.", - "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.", - "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.", - "type": "string", - "example": null - }, - "collection_id": { - "type": "string", - "description": "The Product Collection that the Product belongs to", - "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" - }, - "collection": { - "description": "A product collection object. Available if the relation `collection` is expanded.", - "type": "object" - }, - "type_id": { - "type": "string", - "description": "The Product type that the Product belongs to", - "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" - }, - "type": { - "description": "Available if the relation `type` is expanded.", - "$ref": "#/components/schemas/product_type" - }, - "tags": { - "description": "The Product Tags assigned to the Product. Available if the relation `tags` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/product_tag" - } - }, - "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", - "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": { - "type": "object", - "description": "A sales channel object." - } - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "refund", - "required": [ - "order_id", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The refund's ID", - "example": "ref_01G1G5V27GYX4QXNARRQCW1N8T" - }, - "order_id": { - "description": "The id of the Order that the Refund is related to.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "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.", - "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": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the refund in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "region", - "required": [ - "name", - "currency_code", - "tax_rate" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "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.", - "$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/tax_rate" - } - }, - "tax_code": { - "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.", - "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": { - "type": "string", - "description": "The ID of the tax provider used in this region", - "example": null - }, - "tax_provider": { - "description": "Available if the relation `tax_provider` is expanded.", - "$ref": "#/components/schemas/tax_provider" - }, - "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/payment_provider" - } - }, - "fulfillment_providers": { - "description": "The Fulfillment Providers that can be used to fulfill orders in the Region. Available if the relation `payment_providers` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/fulfillment_provider" - } - }, - "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" - } - } - } - }, - "return_item": { - "title": "Return Item", - "description": "Correlates a Line Item with a Return, keeping track of the quantity of the Line Item that will be returned.", - "x-resourceId": "return_item", - "required": [ - "return_id", - "item_id" - ], - "properties": { - "return_id": { - "description": "The id of the Return that the Return Item belongs to.", - "type": "string", - "example": "ret_01F0YET7XPCMF8RZ0Y151NZV2V" - }, - "return_order": { - "description": "Available if the relation `return_order` is expanded.", - "$ref": "#/components/schemas/return" - }, - "item_id": { - "description": "The id of the Line Item that the Return Item references.", - "type": "string", - "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" - }, - "item": { - "description": "Available if the relation `item` is expanded.", - "$ref": "#/components/schemas/line_item" - }, - "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.", - "type": "integer", - "example": 1 - }, - "recieved_quantity": { - "description": "The quantity that was received in the warehouse.", - "type": "integer", - "example": 1 - }, - "reason_id": { - "description": "The ID of the reason for returning the item.", - "type": "string", - "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" - }, - "reason": { - "description": "Available if the relation `reason` is expanded.", - "$ref": "#/components/schemas/return_reason" - }, - "note": { - "description": "An optional note with additional details about the Return.", - "type": "string", - "example": "I didn't like it." - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "return_reason": { - "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.", - "x-resourceId": "return_reason", - "required": [ - "value", - "label" - ], - "properties": { - "id": { - "type": "string", - "description": "The cart's ID", - "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" - }, - "description": { - "description": "A description of the Reason.", - "type": "string", - "example": "Items that are damaged" - }, - "label": { - "description": "A text that can be displayed to the Customer as a reason.", - "type": "string", - "example": "Damaged goods" - }, - "value": { - "description": "The value to identify the reason by.", - "type": "string", - "example": "damaged" - }, - "parent_return_reason_id": { - "type": "string", - "description": "The ID of the parent reason.", - "example": null - }, - "parent_return_reason": { - "description": "Available if the relation `parent_return_reason` is expanded.", - "$ref": "#/components/schemas/return_reason" - }, - "return_reason_children": { - "description": "Available if the relation `return_reason_children` is expanded.", - "$ref": "#/components/schemas/return_reason" - }, - "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" - } - } - } - }, - "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.", - "x-resourceId": "return", - "required": [ - "refund_amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The return's ID", - "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/return_item" - } - }, - "swap_id": { - "description": "The ID of the Swap that the Return is a part of.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "order_id": { - "description": "The ID of the Order that the Return is made from.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "claim_order_id": { - "description": "The ID of the Claim that the Return is a part of.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "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.", - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "shipping_data": { - "description": "Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment.", - "type": "object", - "example": {} - }, - "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.", - "type": "boolean", - "example": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the return in case of failure.", - "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.", - "type": "string", - "format": "date-time" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "sales_channel": { - "title": "Sales Channel", - "description": "A Sales Channel", - "x-resourceId": "sales_channel", - "required": [ - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The sales channel's ID", - "example": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A" - }, - "name": { - "description": "The name of the sales channel.", - "type": "string", - "example": "Market" - }, - "description": { - "description": "The description of the sales channel.", - "type": "string", - "example": "Multi-vendor market" - }, - "is_disabled": { - "description": "Specify if the sales channel is enabled or disabled.", - "type": "boolean", - "default": false - }, - "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" - } - } - }, - "shipping_method_tax_line": { - "title": "Shipping Method Tax Line", - "description": "Shipping Method Tax Line", - "x-resourceId": "shipping_method_tax_line", - "required": [ - "shipping_method_id", - "rate", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The line item tax line's ID", - "example": "smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" - }, - "shipping_method_id": { - "type": "string", - "description": "The ID of the line item", - "example": "sm_01F0YET7DR2E7CYVSDHM593QG2" - }, - "shipping_method": { - "description": "Available if the relation `shipping_method` is expanded.", - "$ref": "#/components/schemas/shipping_method" - }, - "code": { - "description": "A code to identify the tax type by", - "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": { - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "shipping_method": { - "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.", - "x-resourceId": "shipping_method", - "required": [ - "shipping_option_id", - "price" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping method's ID", - "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" - }, - "shipping_option": { - "description": "Available if the relation `shipping_option` is expanded.", - "$ref": "#/components/schemas/shipping_option" - }, - "order_id": { - "description": "The id of the Order that the Shipping Method is used on.", - "type": "string", - "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" - }, - "order": { - "description": "An order object. Available if the relation `order` is expanded.", - "type": "object" - }, - "return_id": { - "description": "The id of the Return that the Shipping Method is used on.", - "type": "string", - "example": null - }, - "return_order": { - "description": "A return object. Available if the relation `return_order` is expanded.", - "type": "object" - }, - "swap_id": { - "description": "The id of the Swap that the Shipping Method is used on.", - "type": "string", - "example": null - }, - "swap": { - "description": "A swap object. Available if the relation `swap` is expanded.", - "type": "object" - }, - "cart_id": { - "description": "The id of the Cart that the Shipping Method is used on.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "claim_order_id": { - "description": "The id of the Claim that the Shipping Method is used on.", - "type": "string", - "example": null - }, - "claim_order": { - "description": "A claim order object. Available if the relation `claim_order` is expanded.", - "type": "object" - }, - "tax_lines": { - "type": "array", - "description": "Available if the relation `tax_lines` is expanded.", - "items": { - "$ref": "#/components/schemas/shipping_method_tax_line" - } - }, - "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": {} - } - } - }, - "shipping_option_requirement": { - "title": "Shipping Option Requirement", - "description": "A requirement that a Cart must satisfy for the Shipping Option to be available to the Cart.", - "x-resourceId": "shipping_option_requirement", - "required": [ - "shipping_option_id", - "type", - "amount" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping option requirement's ID", - "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.", - "$ref": "#/components/schemas/shipping_option" - }, - "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": { - "type": "string", - "description": "The date with timezone at which the resource was deleted.", - "format": "date-time" - } - } - }, - "shipping_option": { - "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.", - "x-resourceId": "shipping_option", - "required": [ - "name", - "region_id", - "profile_id", - "provider_id", - "price_type" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping option's ID", - "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": { - "type": "string", - "description": "The region's ID", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "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.", - "$ref": "#/components/schemas/shipping_profile" - }, - "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.", - "$ref": "#/components/schemas/fulfillment_provider" - }, - "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`.", - "type": "integer", - "example": 200 - }, - "is_return": { - "description": "Flag to indicate if the Shipping Option can be used for Return shipments.", - "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/shipping_option_requirement" - } - }, - "data": { - "description": "The data needed for the Fulfillment Provider to identify the Shipping Option.", - "type": "object", - "example": {} - }, - "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" - } - } - } - }, - "shipping_profile": { - "title": "Shipping Profile", - "description": "Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products.", - "x-resourceId": "shipping_profile", - "required": [ - "name", - "type" - ], - "properties": { - "id": { - "type": "string", - "description": "The shipping profile's ID", - "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": { - "type": "object", - "description": "A product object." - } - }, - "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/shipping_option" - } - }, - "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" - } - } - } - }, - "shipping_tax_rate": { - "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", - "x-resourceId": "shipping_tax_rate", - "required": [ - "shipping_option_id", - "rate_id" - ], - "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.", - "$ref": "#/components/schemas/shipping_option" - }, - "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.", - "$ref": "#/components/schemas/tax_rate" - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "staged_job": { - "title": "Staged Job", - "description": "A staged job resource", - "x-resourceId": "staged_job", - "required": [ - "event_name" - ], - "properties": { - "id": { - "type": "string", - "description": "The staged job's ID", - "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": {} - } - } - }, - "store": { - "title": "Store", - "description": "Holds settings for the Store, such as name, currencies, etc.", - "x-resourceId": "store", - "properties": { - "id": { - "type": "string", - "description": "The store's ID", - "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.", - "$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.", - "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.", - "type": "string", - "example": null - }, - "invite_link_template": { - "description": "A template to generate Invite links from", - "type": "string", - "example": null - }, - "default_sales_channel_id": { - "type": "string", - "description": "The sales channel ID the cart is associated with.", - "example": null - }, - "default_sales_channel": { - "description": "A sales channel object. Available if the relation `default_sales_channel` is expanded.", - "type": "object" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "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.", - "x-resourceId": "swap", - "required": [ - "fulfillment_status", - "payment_status", - "order_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The swap's ID", - "example": "swap_01F0YET86Y9G92D3YDR9Y6V676" - }, - "fulfillment_status": { - "description": "The status of the Fulfillment of the Swap.", - "type": "string", - "enum": [ - "not_fulfilled", - "fulfilled", - "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.", - "type": "object" - }, - "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/line_item" - } - }, - "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.", - "type": "object" - }, - "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.", - "$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.", - "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.", - "type": "string", - "example": "addr_01G8ZH853YPY9B94857DY91YGW" - }, - "shipping_address": { - "description": "Available if the relation `shipping_address` is expanded.", - "$ref": "#/components/schemas/address" - }, - "shipping_methods": { - "description": "The Shipping Methods used to fulfill the addtional items purchased. Available if the relation `shipping_methods` is expanded.", - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_method" - } - }, - "cart_id": { - "description": "The id of the Cart that the Customer will use to confirm the Swap.", - "type": "string", - "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "cart": { - "description": "A cart object. Available if the relation `cart` is expanded.", - "type": "object" - }, - "allow_backorder": { - "description": "If true, swaps can be completed with items out of stock", - "type": "boolean", - "default": false - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of the swap in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "confirmed_at": { - "description": "The date with timezone at which the Swap was confirmed by the Customer.", - "type": "string", - "format": "date-time" - }, - "canceled_at": { - "description": "The date with timezone at which the Swap was canceled.", - "type": "string", - "format": "date-time" - }, - "no_notification": { - "description": "If set to true, no notification will be sent related to this swap", - "type": "boolean", - "example": false - }, - "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" - } - } - } - }, - "tax_line": { - "title": "Tax Line", - "description": "Line item that specifies an amount of tax to add to a line item.", - "x-resourceId": "tax_line", - "required": [ - "rate", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "The tax line's ID", - "example": "tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" - }, - "code": { - "description": "A code to identify the tax type by", - "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": { - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "tax_provider": { - "title": "Tax Provider", - "description": "The tax service used to calculate taxes", - "x-resourceId": "tax_provider", - "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 - } - } - }, - "tax_rate": { - "title": "Tax Rate", - "description": "A Tax Rate can be used to associate a certain rate to charge on products within a given Region", - "x-resourceId": "line_item", - "required": [ - "name", - "region_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The tax rate's ID", - "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" - }, - "rate": { - "description": "The numeric rate to charge", - "type": "number", - "example": 10 - }, - "code": { - "description": "A code to identify the tax type by", - "type": "string", - "example": "tax01" - }, - "name": { - "description": "A human friendly name for the tax", - "type": "string", - "example": "Tax Example" - }, - "region_id": { - "type": "string", - "description": "The id of the Region that the rate belongs to", - "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" - }, - "region": { - "description": "A region object. Available if the relation `region` is expanded.", - "type": "object" - }, - "products": { - "type": "array", - "description": "The products that belong to this tax rate. Available if the relation `products` is expanded.", - "items": { - "type": "object", - "description": "A product object." - } - }, - "product_types": { - "type": "array", - "description": "The product types that belong to this tax rate. Available if the relation `product_types` is expanded.", - "items": { - "type": "object", - "description": "A product type object." - } - }, - "shipping_options": { - "type": "array", - "description": "The shipping options that belong to this tax rate. Available if the relation `shipping_options` is expanded.", - "items": { - "type": "object", - "description": "A shipping option object." - } - }, - "product_count": { - "description": "The count of products", - "type": "integer", - "example": null - }, - "product_type_count": { - "description": "The count of product types", - "type": "integer", - "example": null - }, - "shipping_option_count": { - "description": "The count of shipping options", - "type": "integer", - "example": null - }, - "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" - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details", - "example": { - "car": "white" - } - } - } - }, - "tracking_link": { - "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.", - "x-resourceId": "tracking_link", - "required": [ - "tracking_number", - "fulfillment_id" - ], - "properties": { - "id": { - "type": "string", - "description": "The tracking link's ID", - "example": "tlink_01G8ZH853Y6TFXWPG5EYE81X63" - }, - "url": { - "description": "The URL at which the status of the shipment can be tracked.", - "type": "string", - "format": "uri" - }, - "tracking_number": { - "description": "The tracking number given by the shipping carrier.", - "type": "string", - "format": "RH370168054CN" - }, - "fulfillment_id": { - "type": "string", - "description": "The id of the Fulfillment that the Tracking Link references.", - "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" - }, - "fulfillment": { - "description": "Available if the relation `fulfillment` is expanded.", - "$ref": "#/components/schemas/fulfillment" - }, - "idempotency_key": { - "type": "string", - "description": "Randomly generated key used to continue the completion of a process in case of failure.", - "externalDocs": { - "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", - "description": "Learn more how to use the idempotency key." - } - }, - "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" - } - } - } - }, - "user": { - "title": "User", - "description": "Represents a User who can manage store settings.", - "x-resourceId": "user", - "required": [ - "email" - ], - "properties": { - "id": { - "type": "string", - "description": "The user's ID", - "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" - }, - "email": { - "description": "The email of the User", - "type": "string", - "format": "email" - }, - "first_name": { - "description": "The first name of the User", - "type": "string", - "example": "Levi" - }, - "last_name": { - "description": "The last name of the User", - "type": "string", - "example": "Bogan" - }, - "api_token": { - "description": "An API token associated with the user.", - "type": "string", - "example": null - }, - "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" - } - } - } - } - } - } -} \ No newline at end of file + }) + + .then(({ swap }) => { + console.log(swap.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST 'https://medusa-url.com/store/swaps' + \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "order_id": "asfasf", + "return_items": [ + { + "item_id": "asfas", + "quantity": 1 + } + ], + "additional_items": [ + { + "variant_id": "asfas", + "quantity": 1 + } + ] + }' + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swap: + $ref: '#/components/schemas/swap' + '400': + $ref: '#/components/responses/400_error' + '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/{cart_id}': + get: + operationId: GetSwapsSwapCartId + summary: Retrieve Swap by Cart id + description: Retrieves a Swap by the id of the Cart used to confirm the Swap. + parameters: + - in: path + name: cart_id + required: true + description: The id of the Cart + 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 }) + + medusa.swaps.retrieveByCartId(cart_id) + + .then(({ swap }) => { + console.log(swap.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/swaps/{cart_id}' + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swap: + $ref: '#/components/schemas/swap' + '400': + $ref: '#/components/responses/400_error' + '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/{variant_id}': + get: + operationId: GetVariantsVariant + summary: Retrieve a Product Variant + description: Retrieves a Product Variant by id + parameters: + - in: path + name: variant_id + required: true + description: The id of the Product Variant. + schema: + type: string + - in: query + name: cart_id + description: The id of the Cart to set prices based on. + schema: + type: string + - in: query + name: region_id + description: The id of the Region to set prices based on. + schema: + type: string + - in: query + name: currency_code + style: form + explode: false + description: The 3 character ISO currency code to set prices based on. + schema: + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/variants/{id}' + tags: + - Product Variant + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variant: + $ref: '#/components/schemas/product_variant' + '400': + $ref: '#/components/responses/400_error' + '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: Retrieve Product Variants + description: Retrieves a list of Product Variants + parameters: + - 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: 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: 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-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/variants' + tags: + - Product Variant + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variants: + type: array + items: + $ref: '#/components/schemas/product_variant' + '400': + $ref: '#/components/responses/400_error' + '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/multiple_errors' + examples: + not_allowed: + $ref: '#/components/examples/not_allowed_error' + invalid_data: + $ref: '#/components/examples/invalid_data_error' + multiple_errors: + $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: + cookie_auth: + type: apiKey + x-displayName: Cookie Session ID + in: cookie + name: connect.sid + 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 customer 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 + customer](#tag/Auth/operation/PostAuth) and pass the cURL option `-v`: + + + ```bash + + curl -v --location --request POST 'https://medusa-url.com/store/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/store/customers/me/orders' \ + + --header 'Cookie: connect.sid={sid}' + + ``` + + + Where `{sid}` is the value of `connect.sid` that you copied. + schemas: + address: + title: Address + description: An address. + x-resourceId: address + properties: + id: + type: string + description: ID of the address + example: addr_01G8ZC9VS1XVE149MGH2J7QSSH + customer_id: + type: string + description: ID of the customer this address belongs to + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: Available if the relation `customer` is expanded. + type: array + items: + type: object + description: A customer object. + 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 + country: + description: A country object. Available if the relation `country` is expanded. + type: object + province: + type: string + description: Province + example: Kentucky + postal_code: + type: string + description: Postal Code + example: 72093 + phone: + type: string + description: Phone Number + 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: + 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 + batch_job: + title: Batch Job + description: A Batch Job. + x-resourceId: batch_job + required: + - type + properties: + id: + type: string + description: The unique identifier for the batch job. + example: batch_01G8T782965PYFG0751G0Z38B4 + type: + type: string + description: The type of batch job. + enum: + - product-import + - product-export + status: + type: string + description: The status of the batch job. + enum: + - created + - pre_processed + - confirmed + - processing + - completed + - canceled + - failed + default: created + created_by: + type: string + description: The unique identifier of the user that created the batch job. + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + created_by_user: + description: >- + A user object. Available if the relation `created_by_user` is + expanded. + type: object + context: + type: object + description: >- + The context of the batch job, the type of the batch job determines + what the context should contain. + 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: Specify if the job must apply the modifications or not. + default: false + result: + type: object + description: The result of the batch job. + 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: + type: string + description: The date from which the job has been pre processed. + format: date-time + processing_at: + type: string + description: The date the job is processing at. + format: date-time + confirmed_at: + type: string + description: The date when the confirmation has been done. + format: date-time + completed_at: + type: string + description: The date of the completion. + format: date-time + canceled_at: + type: string + description: The date of the concellation. + format: date-time + failed_at: + type: string + description: The date when the job failed. + format: date-time + 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 last updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + cart: + title: Cart + description: Represents a user cart + x-resourceId: cart + properties: + id: + type: string + description: The cart's ID + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + email: + type: string + description: The email associated with the cart + format: email + billing_address_id: + type: string + description: The billing address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_address_id: + type: string + description: The shipping address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + items: + description: Available if the relation `items` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item' + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + discounts: + type: array + description: Available if the relation `discounts` is expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: Available if the relation `gift_cards` is expanded. + items: + type: object + description: A gift card object. + customer_id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + payment_session: + description: The selected payment session in the cart. + $ref: '#/components/schemas/payment_session' + payment_sessions: + type: array + description: The payment sessions created on the cart. + items: + $ref: '#/components/schemas/payment_session' + payment_id: + type: string + description: The payment's ID if available + example: pay_01G8ZCC5W42ZNY842124G7P5R9 + payment: + description: Available if the relation `payment` is expanded. + $ref: '#/components/schemas/payment' + shipping_methods: + type: array + description: The shipping methods added to the cart. + items: + $ref: '#/components/schemas/shipping_method' + type: + type: string + description: The cart's type. + enum: + - default + - swap + - draft_order + - payment_link + - claim + default: default + completed_at: + type: string + description: The date with timezone at which the cart was completed. + format: date-time + payment_authorized_at: + type: string + description: The date with timezone at which the payment was authorized. + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + context: + type: object + description: >- + The context of the cart which can include info like IP or user + agent. + example: + ip: '::1' + user_agent: PostmanRuntime/7.29.2 + sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + 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 + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: >- + The total amount refunded if the order associated with this cart is + returned. + example: 0 + total: + type: integer + description: The total amount of the cart + example: 8200 + subtotal: + type: integer + description: The subtotal of the cart + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 + claim_image: + title: Claim Image + description: Represents photo documentation of a claim. + x-resourceId: claim_image + required: + - claim_item_id + - url + properties: + id: + type: string + description: The claim image's ID + example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 + claim_item_id: + type: string + description: The ID of the claim item associated with the image + claim_item: + description: >- + A claim item object. Available if the relation `claim_item` is + expanded. + type: object + url: + type: string + description: The URL of the image + format: uri + 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 + claim_item: + title: Claim Item + description: >- + Represents a claimed item along with information about the reasons for + the claim. + x-resourceId: claim_item + required: + - claim_order_id + - item_id + - variant_id + - reason + - quantity + properties: + id: + type: string + description: The claim item's ID + example: citm_01G8ZH853Y6TFXWPG5EYE81X63 + images: + type: array + description: Available if the relation `images` is expanded. + items: + $ref: '#/components/schemas/claim_image' + 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. + type: object + 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. + $ref: '#/components/schemas/line_item' + 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. + type: object + 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' + 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/claim_tag' + 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 + claim_order: + 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. + x-resourceId: claim_order + required: + - type + - order_id + properties: + id: + type: string + description: The claim's ID + example: claim_01G8ZH853Y6TFXWPG5EYE81X63 + type: + type: string + enum: + - refund + - replace + payment_status: + type: string + description: The status of the claim's payment + enum: + - na + - not_refunded + - refunded + default: na + 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/claim_item' + 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/line_item' + 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. + type: object + 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 + type: object + shipping_address_id: + description: The ID of the address that the new items should be shipped to + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + shipping_methods: + description: The shipping methods that the claim order will be shipped with. + type: array + items: + $ref: '#/components/schemas/shipping_method' + 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 + type: integer + example: 1000 + canceled_at: + description: The date with timezone at which the claim was canceled. + type: string + format: date-time + 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 + no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the claim in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + claim_tag: + title: Claim Tag + description: >- + Claim Tags are user defined tags that can be assigned to claim items for + easy filtering and grouping. + x-resourceId: claim_tag + required: + - value + properties: + id: + type: string + description: The claim tag's ID + example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 + value: + description: The value that the claim tag holds + type: string + example: Damaged + 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 + country: + title: Country + description: Country details + x-resourceId: country + required: + - iso_2 + - iso_3 + - num_code + - name + - display_name + properties: + id: + type: string + description: The country's ID + example: 109 + iso_2: + type: string + description: The 2 character ISO code of the country in lower case + 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: + type: string + description: The 2 character ISO code of the country in lower case + 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: + type: string + description: The region ID this country is associated with. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + currency: + title: Currency + description: Currency + x-resourceId: currency + required: + - code + - symbol + - symbol_native + - name + 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 + custom_shipping_option: + 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 + x-resourceId: custom_shipping_option + required: + - price + - shipping_option_id + properties: + id: + type: string + description: The custom shipping option's ID + 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. + type: object + cart_id: + description: The ID of the Cart that the custom shipping option is attached to + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + 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 + customer_group: + title: Customer Group + description: Represents a customer group + x-resourceId: customer_group + required: + - name + properties: + id: + type: string + description: The customer group's ID + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 + name: + type: string + description: The name of the customer group + example: VIP + customers: + type: array + description: >- + The customers that belong to the customer group. Available if the + relation `customers` is expanded. + items: + type: object + description: A customer object. + price_lists: + type: array + description: >- + The price lists that are associated with the customer group. + Available if the relation `price_lists` is expanded. + items: + $ref: '#/components/schemas/price_list' + 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 + customer: + title: Customer + description: Represents a customer + x-resourceId: customer + required: + - email + properties: + id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + email: + type: string + description: The customer's email + format: email + first_name: + type: string + description: The customer's first name + example: Arno + last_name: + type: string + description: The customer's first name + example: Willms + billing_address_id: + type: string + description: The customer's billing address ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_addresses: + description: Available if the relation `shipping_addresses` is expanded. + type: array + items: + $ref: '#/components/schemas/address' + phone: + type: string + description: The customer's phone number + example: 16128234334802 + has_account: + type: boolean + description: Whether the customer has an account or not + default: false + orders: + description: Available if the relation `orders` is expanded. + type: array + items: + type: object + description: An order object. + groups: + description: >- + The customer groups the customer belongs to. Available if the + relation `groups` is expanded. + type: array + items: + $ref: '#/components/schemas/customer_group' + 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 + discount_condition_customer_group: + title: Product Tag Discount Condition + description: Associates a discount condition with a customer group + x-resourceId: discount_condition_customer_group + required: + - customer_group_id + - condition_id + 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. + $ref: '#/components/schemas/customer_group' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product_collection: + title: Product Collection Discount Condition + description: Associates a discount condition with a product collection + x-resourceId: discount_condition_product_collection + required: + - product_collection_id + - condition_id + 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. + $ref: '#/components/schemas/product_collection' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product_tag: + title: Product Tag Discount Condition + description: Associates a discount condition with a product tag + x-resourceId: discount_condition_product_tag + required: + - product_tag_id + - condition_id + 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. + $ref: '#/components/schemas/product_tag' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product_type: + title: Product Type Discount Condition + description: Associates a discount condition with a product type + x-resourceId: discount_condition_product + required: + - product_type_id + - condition_id + 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. + $ref: '#/components/schemas/product_type' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition_product: + title: Product Discount Condition + description: Associates a discount condition with a product + x-resourceId: discount_condition_product + required: + - product_id + - condition_id + 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. + $ref: '#/components/schemas/product' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + discount_condition: + title: Discount Condition + description: Holds rule conditions for when a discount is applicable + x-resourceId: discount_condition + required: + - type + - operator + - discount_rule_id + properties: + id: + type: string + description: The discount condition's ID + 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: + type: string + description: The ID of the discount rule associated with the condition + example: dru_01F0YESMVK96HVX7N419E3CJ7C + discount_rule: + description: Available if the relation `discount_rule` is expanded. + $ref: '#/components/schemas/discount_rule' + products: + description: >- + products associated with this condition if type = products. + Available if the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + product_types: + description: >- + product types associated with this condition if type = + product_types. Available if the relation `product_types` is + expanded. + type: array + items: + type: object + description: A product type object. + product_tags: + description: >- + product tags associated with this condition if type = product_tags. + Available if the relation `product_tags` is expanded. + type: array + items: + type: object + description: A product tag object. + product_collections: + description: >- + product collections associated with this condition if type = + product_collections. Available if the relation `product_collections` + is expanded. + type: array + items: + type: object + description: A product collection object. + customer_groups: + description: >- + customer groups associated with this condition if type = + customer_groups. Available if the relation `customer_groups` is + expanded. + type: array + items: + type: object + description: A customer group object. + 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 + discount_rule: + title: Discount Rule + description: >- + Holds the rules that governs how a Discount is calculated when applied + to a Cart. + x-resourceId: discount_rule + required: + - type + - value + properties: + id: + type: string + description: The discount rule's ID + 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 + 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. + 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: + type: object + description: A discount condition object. + 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 + discount: + title: Discount + description: >- + Represents a discount that can be applied to a cart for promotional + purposes. + x-resourceId: discount + required: + - code + - is_dynamic + properties: + id: + type: string + description: The discount's ID + 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: + type: string + description: The Discount Rule that governs the behaviour of the Discount + example: dru_01F0YESMVK96HVX7N419E3CJ7C + rule: + description: Available if the relation `rule` is expanded. + $ref: '#/components/schemas/discount_rule' + is_disabled: + description: >- + Whether the Discount has been disabled. Disabled discounts cannot be + applied to carts + type: boolean + example: false + parent_discount_id: + type: string + description: >- + The Discount that the discount was created from. This will always be + a dynamic discount + example: disc_01G8ZH853YPY9B94857DY91YGW + parent_discount: + description: Available if the relation `parent_discount` is expanded. + $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. + type: string + format: date-time + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S + regions: + description: >- + The Regions in which the Discount can be used. Available if the + relation `regions` is expanded. + type: array + items: + type: object + description: A region object. + usage_limit: + description: The maximum number of times that a discount can be used. + type: integer + example: 100 + usage_count: + description: The number of times a discount has been used. + type: integer + example: 50 + default: 0 + 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 + draft-order: + title: DraftOrder + description: Represents a draft order + x-resourceId: draft-order + properties: + id: + type: string + description: The draft order's ID + example: dorder_01G8TJFKBG38YYFQ035MSVG03C + status: + type: string + description: The status of the draft order + enum: + - open + - completed + default: open + display_id: + type: string + description: The draft order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the draft order. + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + type: string + description: The ID of the order associated with the draft order. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + canceled_at: + type: string + description: The date the draft order was canceled at. + format: date-time + completed_at: + type: string + description: The date the draft order was completed at. + format: date-time + no_notification_order: + type: boolean + description: Whether to send the customer notifications regarding order updates. + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the draft order in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + fulfillment_item: + title: Fulfillment Item + description: >- + Correlates a Line Item with a Fulfillment, keeping track of the quantity + of the Line Item. + x-resourceId: fulfillment_item + 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. + type: object + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + quantity: + description: The quantity of the Line Item that is included in the Fulfillment. + type: integer + example: 1 + fulfillment_provider: + title: Fulfillment Provider + description: >- + Represents a fulfillment provider plugin and holds its installation + status. + x-resourceId: fulfillment_provider + 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 + example: 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. + x-resourceId: fulfillment + required: + - provider_id + properties: + id: + type: string + description: The cart's ID + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + claim_order_id: + description: The id of the Claim that the Fulfillment belongs to. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + swap_id: + description: The id of the Swap that the Fulfillment belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The id of the Order that the Fulfillment belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + 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. + $ref: '#/components/schemas/fulfillment_provider' + 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/fulfillment_item' + 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/tracking_link' + tracking_numbers: + deprecated: true + description: >- + The tracking numbers that can be used to track the status of the + fulfillment. + 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. + type: string + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. + type: boolean + example: false + canceled_at: + description: The date with timezone at which the Fulfillment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the + fulfillment in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + gift_card_transaction: + title: Gift Card Transaction + description: >- + Gift Card Transactions are created once a Customer uses a Gift Card to + pay for their Order + x-resourceId: gift_card_transaction + required: + - gift_card_id + - amount + properties: + id: + type: string + description: The gift card transaction's ID + 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. + type: object + 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. + type: object + 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. + type: boolean + example: false + tax_rate: + description: The tax rate of the transaction + type: number + example: 0 + gift_card: + title: Gift Card + description: >- + Gift Cards are redeemable and represent a value that can be used towards + the payment of an Order. + x-resourceId: gift_card + required: + - code + - value + - balance + - region_id + properties: + id: + type: string + description: The cart's ID + 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: + type: string + description: The id of the Region in which the Gift Card is available. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + order_id: + type: string + description: The id of the Order that the Gift Card was purchased in. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + is_disabled: + description: >- + Whether the Gift Card has been disabled. Disabled Gift Cards cannot + be applied to carts. + type: boolean + example: false + ends_at: + description: The time at which the Gift Card can no longer be used. + type: string + format: date-time + 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 + idempotency_key: + title: Idempotency Key + description: >- + Idempotency Key is used to continue a process in case of any failure + that might occur. + x-resourceId: idempotency_key + required: + - idempotency_key + properties: + id: + type: string + description: The idempotency key's ID + 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. + type: string + format: date-time + request_method: + description: The method of the request + type: string + example: POST + request_params: + type: object + description: The parameters passed to the request + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + request_path: + description: The request's path + type: string + example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete + response_code: + type: string + description: The response's code. + example: 200 + response_body: + type: object + description: The response's body + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + recovery_point: + type: string + description: Where to continue from. + default: started + image: + title: Image + description: Images holds a reference to a URL at which the image file can be found. + x-resourceId: image + required: + - 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: + 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 + invite: + title: Invite + description: Represents an invite + x-resourceId: invite + required: + - user_email + properties: + id: + type: string + description: The invite's ID + example: invite_01G8TKE4XYCTHSCK2GDEP47RE1 + user_email: + type: string + description: The email of the user being invited. + format: email + role: + type: string + description: The user's role. + enum: + - admin + - member + - developer + default: member + accepted: + type: boolean + description: Whether the invite was accepted or not. + example: false + token: + type: string + description: The token used to accept the invite. + expores_at: + type: string + description: The date the invite expires at. + format: date-time + 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 + line_item_adjustment: + title: Line Item Adjustment + description: Represents an Line Item Adjustment + x-resourceId: line_item_adjustment + required: + - item_id + - description + - amount + properties: + id: + type: string + description: The invite's ID + example: lia_01G8TKE4XYCTHSCK2GDEP47RE1 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + description: + type: string + description: The line item's adjustment description + example: Adjusted item's price. + discount_id: + type: string + description: The ID of the discount associated with the adjustment + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + discount: + description: Available if the relation `discount` is expanded. + $ref: '#/components/schemas/discount' + amount: + type: number + description: The adjustment amount + example: 1000 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + line_item_tax_line: + title: Line Item Tax Line + description: Represents an Line Item Tax Line + x-resourceId: line_item_tax_line + required: + - item_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + code: + description: A code to identify the tax type by + 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: + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + line_item: + 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. + x-resourceId: line_item + required: + - title + - unit_price + - quantity + properties: + id: + type: string + description: The cart's ID + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + cart_id: + description: The ID of the Cart that the Line Item belongs to. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Line Item belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Line Item belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Line Item belongs to. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + description: Available if the relation `tax_lines` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_tax_line' + adjustments: + description: Available if the relation `adjustments` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_adjustment' + 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. + type: string + example: One Size + thumbnail: + description: A URL string to a small image of the contents of the Line Item. + 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 + example: false + is_giftcard: + description: Flag to indicate if the Line Item is a Gift Card. + type: boolean + example: 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 + example: false + allow_discounts: + description: >- + Flag to indicate if the Line Item should be included when doing + discount calculations. + type: boolean + example: false + has_shipping: + description: >- + Flag to indicate if the Line Item has fulfillment associated with + it. + 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: boolean + example: 8000 + variant_id: + description: The id of the Product Variant contained in the Line Item. + 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. + type: object + 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. + type: integer + example: 0 + returned_quantity: + description: The quantity of the Line Item that has been returned. + type: integer + example: 0 + shipped_quantity: + description: The quantity of the Line Item that has been shipped. + 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: + type: integer + description: The subtotal of the line item + example: 8000 + tax_total: + type: integer + description: The total of tax of the line item + example: 0 + total: + type: integer + description: The total amount of the line item + example: 8000 + original_total: + type: integer + description: The original total amount of the line item + example: 8000 + original_tax_total: + type: integer + description: The original tax total amount of the line item + example: 0 + discount_total: + type: integer + description: The total of discount of the line item + example: 0 + gift_card_total: + type: integer + description: The total of the gift card of the line item + example: 0 + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + money_amount: + 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. + x-resourceId: money_amount + required: + - currency_code + - amount + properties: + id: + type: string + description: The money amount's ID + 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. + $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. + 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. + type: integer + example: 1 + price_list_id: + type: string + description: The ID of the price list associated with the money amount + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + price_list: + description: Available if the relation `price_list` is expanded. + $ref: '#/components/schemas/price_list' + variant_id: + description: The id of the Product Variant contained in the Line Item. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + The Product Variant contained in the Line Item. Available if the + relation `variant` is expanded. + type: object + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + 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 + 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. + x-resourceId: note + required: + - value + - resource_type + - resource_id + properties: + id: + type: string + description: The note's ID + 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: + type: string + description: The ID of the author (user) + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + author: + description: Available if the relation `author` is expanded. + $ref: '#/components/schemas/user' + 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 + notification_provider: + title: Notification Provider + description: >- + Represents a notification provider plugin and holds its installation + status. + x-resourceId: notification_provider + required: + - id + 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. + x-resourceId: notification + required: + - resource_type + - resource_id + - to + properties: + id: + type: string + description: The notification's ID + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + event_name: + description: The name of the event that the notification was sent for. + 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. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + 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: {} + resends: + description: >- + The resends that have been completed after the original + Notification. + type: array + items: + $ref: '#/components/schemas/notification_resend' + provider_id: + description: The id of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' + 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 + notification_resend: + title: Notification Resend + description: A resend of a Notification. + x-resourceId: notification_resend + properties: + id: + description: The notification resend's ID + type: string + example: noti_01F0YET45G9NHP08Z66CE4QKBS + event_name: + description: The name of the event that the notification was sent for. + 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. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + 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 ID of the Notification that was originally sent. + type: string + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + parent_notification: + description: Available if the relation `parent_notification` is expanded. + $ref: '#/components/schemas/notification' + provider_id: + description: The ID of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' + 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 + OAuth: + title: OAuth + description: Represent an OAuth app + x-resourceId: OAuth + required: + - id + - display_name + - application_name + properties: + id: + type: string + description: The app's ID + example: example_app + display_name: + type: string + description: The app's display name + example: Example app + application_name: + type: string + description: The app's name + example: example + install_url: + type: string + description: The URL to install the app + format: uri + uninstall_url: + type: string + description: The URL to uninstall the app + format: uri + data: + type: object + description: Any data necessary to the app. + example: {} + order: + title: Order + description: Represents an order + x-resourceId: order + required: + - customer_id + - email + - region_id + - currency_code + properties: + id: + type: string + description: The order's ID + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + status: + type: string + description: The order's status + enum: + - pending + - completed + - archived + - canceled + - requires_action + default: pending + fulfillment_status: + type: string + description: The order's fulfillment status + enum: + - not_fulfilled + - partially_fulfilled + - fulfilled + - partially_shipped + - shipped + - partially_returned + - returned + - canceled + - requires_action + default: not_fulfilled + payment_status: + type: string + description: The order's payment status + enum: + - not_paid + - awaiting + - captured + - partially_refunded + - refuneded + - canceled + - requires_action + default: not_paid + display_id: + type: integer + description: The order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the order + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + customer_id: + type: string + description: The ID of the customer associated with the order + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + email: + description: The email associated with the order + type: string + format: email + billing_address_id: + type: string + description: The ID of the billing address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_address_id: + type: string + description: The ID of the shipping address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + 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. + $ref: '#/components/schemas/currency' + tax_rate: + description: The order's tax rate + type: number + example: 0 + discounts: + type: array + description: >- + The discounts used in the order. Available if the relation + `discounts` is expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: >- + The gift cards used in the order. Available if the relation + `gift_cards` is expanded. + items: + type: object + description: A gift card object. + shipping_methods: + type: array + description: >- + The shipping methods used in the order. Available if the relation + `shipping_methods` is expanded. + items: + $ref: '#/components/schemas/shipping_method' + payments: + type: array + description: >- + The payments used in the order. Available if the relation `payments` + is expanded. + items: + $ref: '#/components/schemas/payment' + fulfillments: + type: array + description: >- + The fulfillments used in the order. Available if the relation + `fulfillments` is expanded. + items: + $ref: '#/components/schemas/fulfillment' + returns: + type: array + description: >- + The returns associated with the order. Available if the relation + `returns` is expanded. + items: + type: object + description: A return object. + claims: + type: array + description: >- + The claims associated with the order. Available if the relation + `claims` is expanded. + items: + type: object + description: A claim order object. + refunds: + type: array + description: >- + The refunds associated with the order. Available if the relation + `refunds` is expanded. + items: + type: object + description: A refund object. + swaps: + type: array + description: >- + The swaps associated with the order. Available if the relation + `swaps` is expanded. + items: + type: object + description: A swap object. + draft_order_id: + type: string + description: The ID of the draft order this order is associated with. + example: null + draft_order: + description: >- + A draft order object. Available if the relation `draft_order` is + expanded. + type: object + items: + type: array + description: >- + The line items that belong to the order. Available if the relation + `items` is expanded. + items: + $ref: '#/components/schemas/line_item' + gift_card_transactions: + type: array + description: >- + The gift card transactions used in the order. Available if the + relation `gift_card_transactions` is expanded. + items: + $ref: '#/components/schemas/gift_card_transaction' + canceled_at: + type: string + description: The date the order was canceled on. + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the processing of the order + in case of failure. + 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. + type: string + example: null + sales_channel_id: + type: string + description: The ID of the sales channel this order is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: The total amount refunded if the order is returned. + example: 0 + total: + type: integer + description: The total amount of the order + example: 8200 + subtotal: + type: integer + description: The subtotal of the order + example: 8000 + paid_total: + type: integer + description: The total amount paid + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 + payment_provider: + title: Payment Provider + description: Represents a Payment Provider plugin and holds its installation status. + x-resourceId: payment_provider + required: + - id + 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 + payment_session: + 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. + x-resourceId: payment_session + required: + - cart_id + - provider_id + - status + properties: + id: + type: string + description: The payment session's ID + example: ps_01G901XNSRM2YS3ASN9H5KG3FZ + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + 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. + type: boolean + 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: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + payment: + title: Payment + description: >- + Payments represent an amount authorized with a given payment method, + Payments can be captured, canceled or refunded. + x-resourceId: payment + required: + - amount + - currency_code + - provider_id + properties: + id: + type: string + description: The payment's ID + example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE + swap_id: + description: The ID of the Swap that the Payment is used for. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Payment is used for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + 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. + $ref: '#/components/schemas/currency' + amount_refunded: + description: >- + The amount of the original Payment amount that has been refunded + back to the Customer. + type: integer + 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. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Payment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a payment + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + price_list: + title: Price List + description: >- + Price Lists represents a set of prices that overrides the default price + for one or more product variants. + x-resourceId: price_list + required: + - name + - description + properties: + id: + type: string + description: The price list's ID + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + name: + type: string + description: The price list's name + example: VIP Prices + description: + type: string + description: The price list's description + 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. + type: string + format: date-time + ends_at: + description: The date with timezone that the Price List stops being valid. + 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: + type: object + description: A customer group object. + 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/money_amount' + 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 + product_collection: + title: Product Collection + description: Product Collections represents a group of Products that are related. + x-resourceId: product_collection + required: + - title + properties: + id: + type: string + description: The product collection's ID + 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. + type: string + example: summer-collection + products: + description: >- + The Products contained in the Product Collection. Available if the + relation `products` is expanded. + type: array + items: + type: object + description: A product collection object. + 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 + product_option_value: + 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. + x-resourceId: product_option_value + required: + - value + - option_id + - variant_id + properties: + id: + type: string + description: The product option value's ID + 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. + $ref: '#/components/schemas/product_option' + 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. + $ref: '#/components/schemas/product_variant' + 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 + product_option: + 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. + x-resourceId: product_option + required: + - title + - product_id + properties: + id: + type: string + description: The product option's ID + 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/product_option_value' + 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. + type: object + 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 + product_tag: + title: Product Tag + description: Product Tags can be added to Products for easy filtering and grouping. + x-resourceId: product_tag + required: + - value + properties: + id: + type: string + description: The product tag's ID + example: ptag_01G8K2MTMG9168F2B70S1TAVK3 + value: + description: The value that the Product Tag represents + type: string + example: Pants + 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 + product_tax_rate: + title: Product Tax Rate + description: >- + Associates a tax rate with a product to indicate that the product is + taxed in a certain way + x-resourceId: product_tax_rate + required: + - product_id + - rate_id + properties: + product_id: + description: The ID of the Product + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: Available if the relation `product` is expanded. + $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. + $ref: '#/components/schemas/tax_rate' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + product_type_tax_rate: + 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 + x-resourceId: product_type_tax_rate + required: + - product_type_id + - rate_id + 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. + $ref: '#/components/schemas/product_type' + 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. + $ref: '#/components/schemas/tax_rate' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + product_type: + title: Product Type + description: >- + Product Type can be added to Products for filtering and reporting + purposes. + x-resourceId: product_type + required: + - value + properties: + id: + type: string + description: The product type's ID + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + value: + description: The value that the Product Type represents. + type: string + example: Clothing + 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 + product_variant: + 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. + x-resourceId: product_variant + required: + - title + - product_id + - inventory_quantity + properties: + id: + type: string + description: The product variant's ID + 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. + type: object + 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/money_amount' + 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. + type: string + example: shirt-123 + barcode: + description: >- + A generic field for a GTIN number that can be used to identify the + Product Variant. + type: string + example: null + ean: + description: >- + An EAN barcode number that can be used to identify the Product + Variant. + type: string + example: null + upc: + description: >- + A UPC barcode number that can be used to identify the Product + Variant. + type: string + example: null + variant_rank: + description: The ranking of this variant + 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. + 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. + 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. + 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. + type: string + example: null + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + 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/product_option_value' + 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 + 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. + x-resourceId: product + required: + - title + - profile_id + properties: + id: + type: string + description: The product's ID + 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. + type: string + description: + description: A short description of the Product. + type: string + example: Every programmer's best friend. + handle: + description: A unique identifier for the Product (e.g. for slug structure). + 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. + 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/product_option' + 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/product_variant' + 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. + $ref: '#/components/schemas/shipping_profile' + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + 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. + 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. + 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. + 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. + type: string + example: null + collection_id: + type: string + description: The Product Collection that the Product belongs to + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + collection: + description: >- + A product collection object. Available if the relation `collection` + is expanded. + type: object + type_id: + type: string + description: The Product type that the Product belongs to + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: Available if the relation `type` is expanded. + $ref: '#/components/schemas/product_type' + tags: + description: >- + The Product Tags assigned to the Product. Available if the relation + `tags` is expanded. + type: array + items: + $ref: '#/components/schemas/product_tag' + 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 + 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: + type: object + description: A sales channel object. + 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 + 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. + x-resourceId: refund + required: + - order_id + - amount + properties: + id: + type: string + description: The refund's ID + example: ref_01G1G5V27GYX4QXNARRQCW1N8T + order_id: + description: The id of the Order that the Refund is related to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + 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. + 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: + type: string + description: >- + Randomly generated key used to continue the completion of the refund + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + 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. + x-resourceId: region + required: + - name + - currency_code + - tax_rate + properties: + id: + type: string + description: The cart's ID + 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. + $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/tax_rate' + tax_code: + description: >- + The tax code used on purchases in the Region. This may be used by + other systems for accounting purposes. + 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: + type: string + description: The ID of the tax provider used in this region + example: null + tax_provider: + description: Available if the relation `tax_provider` is expanded. + $ref: '#/components/schemas/tax_provider' + 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/payment_provider' + fulfillment_providers: + description: >- + The Fulfillment Providers that can be used to fulfill orders in the + Region. Available if the relation `payment_providers` is expanded. + type: array + items: + $ref: '#/components/schemas/fulfillment_provider' + 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 + return_item: + title: Return Item + description: >- + Correlates a Line Item with a Return, keeping track of the quantity of + the Line Item that will be returned. + x-resourceId: return_item + required: + - return_id + - item_id + properties: + return_id: + description: The id of the Return that the Return Item belongs to. + type: string + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + return_order: + description: Available if the relation `return_order` is expanded. + $ref: '#/components/schemas/return' + item_id: + description: The id of the Line Item that the Return Item references. + type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + 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. + type: integer + example: 1 + recieved_quantity: + description: The quantity that was received in the warehouse. + type: integer + example: 1 + reason_id: + description: The ID of the reason for returning the item. + type: string + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + reason: + description: Available if the relation `reason` is expanded. + $ref: '#/components/schemas/return_reason' + note: + description: An optional note with additional details about the Return. + type: string + example: I didn't like it. + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + return_reason: + 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. + x-resourceId: return_reason + required: + - value + - label + properties: + id: + type: string + description: The cart's ID + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + description: + description: A description of the Reason. + type: string + example: Items that are damaged + label: + description: A text that can be displayed to the Customer as a reason. + type: string + example: Damaged goods + value: + description: The value to identify the reason by. + type: string + example: damaged + parent_return_reason_id: + type: string + description: The ID of the parent reason. + example: null + parent_return_reason: + description: Available if the relation `parent_return_reason` is expanded. + $ref: '#/components/schemas/return_reason' + return_reason_children: + description: Available if the relation `return_reason_children` is expanded. + $ref: '#/components/schemas/return_reason' + 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 + 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. + x-resourceId: return + required: + - refund_amount + properties: + id: + type: string + description: The return's ID + 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/return_item' + swap_id: + description: The ID of the Swap that the Return is a part of. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The ID of the Order that the Return is made from. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + claim_order_id: + description: The ID of the Claim that the Return is a part of. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + 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. + type: array + items: + $ref: '#/components/schemas/shipping_method' + shipping_data: + description: >- + Data about the return shipment as provided by the Fulfilment + Provider that handles the return shipment. + type: object + example: {} + 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. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the return + in case of failure. + 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. + type: string + format: date-time + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + sales_channel: + title: Sales Channel + description: A Sales Channel + x-resourceId: sales_channel + required: + - name + properties: + id: + type: string + description: The sales channel's ID + example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A + name: + description: The name of the sales channel. + type: string + example: Market + description: + description: The description of the sales channel. + type: string + example: Multi-vendor market + is_disabled: + description: Specify if the sales channel is enabled or disabled. + type: boolean + default: false + 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 + shipping_method_tax_line: + title: Shipping Method Tax Line + description: Shipping Method Tax Line + x-resourceId: shipping_method_tax_line + required: + - shipping_method_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + shipping_method_id: + type: string + description: The ID of the line item + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_method: + description: Available if the relation `shipping_method` is expanded. + $ref: '#/components/schemas/shipping_method' + code: + description: A code to identify the tax type by + 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: + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + shipping_method: + 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. + x-resourceId: shipping_method + required: + - shipping_option_id + - price + properties: + id: + type: string + description: The shipping method's ID + 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 + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' + order_id: + description: The id of the Order that the Shipping Method is used on. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + return_id: + description: The id of the Return that the Shipping Method is used on. + type: string + example: null + return_order: + description: >- + A return object. Available if the relation `return_order` is + expanded. + type: object + swap_id: + description: The id of the Swap that the Shipping Method is used on. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Shipping Method is used on. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Shipping Method is used on. + type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + type: array + description: Available if the relation `tax_lines` is expanded. + items: + $ref: '#/components/schemas/shipping_method_tax_line' + 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: {} + shipping_option_requirement: + title: Shipping Option Requirement + description: >- + A requirement that a Cart must satisfy for the Shipping Option to be + available to the Cart. + x-resourceId: shipping_option_requirement + required: + - shipping_option_id + - type + - amount + properties: + id: + type: string + description: The shipping option requirement's ID + 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. + $ref: '#/components/schemas/shipping_option' + 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: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + shipping_option: + 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. + x-resourceId: shipping_option + required: + - name + - region_id + - profile_id + - provider_id + - price_type + properties: + id: + type: string + description: The shipping option's ID + 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: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + 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. + $ref: '#/components/schemas/shipping_profile' + 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. + $ref: '#/components/schemas/fulfillment_provider' + 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`. + type: integer + example: 200 + is_return: + description: >- + Flag to indicate if the Shipping Option can be used for Return + shipments. + 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/shipping_option_requirement' + data: + description: >- + The data needed for the Fulfillment Provider to identify the + Shipping Option. + type: object + example: {} + 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 + shipping_profile: + title: Shipping Profile + description: >- + Shipping Profiles have a set of defined Shipping Options that can be + used to fulfill a given set of Products. + x-resourceId: shipping_profile + required: + - name + - type + properties: + id: + type: string + description: The shipping profile's ID + 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: + type: object + description: A product object. + 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/shipping_option' + 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 + shipping_tax_rate: + 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 + x-resourceId: shipping_tax_rate + required: + - shipping_option_id + - rate_id + 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. + $ref: '#/components/schemas/shipping_option' + 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. + $ref: '#/components/schemas/tax_rate' + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + staged_job: + title: Staged Job + description: A staged job resource + x-resourceId: staged_job + required: + - event_name + properties: + id: + type: string + description: The staged job's ID + 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: {} + store: + title: Store + description: 'Holds settings for the Store, such as name, currencies, etc.' + x-resourceId: store + properties: + id: + type: string + description: The store's ID + 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. + $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. + 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. + type: string + example: null + invite_link_template: + description: A template to generate Invite links from + type: string + example: null + default_sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + default_sales_channel: + description: >- + A sales channel object. Available if the relation + `default_sales_channel` is expanded. + type: object + metadata: + type: object + description: An optional key-value map with additional details + 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. + x-resourceId: swap + required: + - fulfillment_status + - payment_status + - order_id + properties: + id: + type: string + description: The swap's ID + example: swap_01F0YET86Y9G92D3YDR9Y6V676 + fulfillment_status: + description: The status of the Fulfillment of the Swap. + type: string + enum: + - not_fulfilled + - fulfilled + - 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. + type: object + 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/line_item' + 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. + type: object + 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. + $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. + 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. + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + shipping_methods: + description: >- + The Shipping Methods used to fulfill the addtional items purchased. + Available if the relation `shipping_methods` is expanded. + type: array + items: + $ref: '#/components/schemas/shipping_method' + cart_id: + description: The id of the Cart that the Customer will use to confirm the Swap. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + allow_backorder: + description: 'If true, swaps can be completed with items out of stock' + type: boolean + default: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the swap + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + confirmed_at: + description: >- + The date with timezone at which the Swap was confirmed by the + Customer. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Swap was canceled. + type: string + format: date-time + no_notification: + description: 'If set to true, no notification will be sent related to this swap' + type: boolean + example: false + 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 + tax_line: + title: Tax Line + description: Line item that specifies an amount of tax to add to a line item. + x-resourceId: tax_line + required: + - rate + - name + properties: + id: + type: string + description: The tax line's ID + example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + code: + description: A code to identify the tax type by + 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: + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + tax_provider: + title: Tax Provider + description: The tax service used to calculate taxes + x-resourceId: tax_provider + 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 + tax_rate: + title: Tax Rate + description: >- + A Tax Rate can be used to associate a certain rate to charge on products + within a given Region + x-resourceId: line_item + required: + - name + - region_id + properties: + id: + type: string + description: The tax rate's ID + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + rate: + description: The numeric rate to charge + type: number + example: 10 + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + region_id: + type: string + description: The id of the Region that the rate belongs to + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + products: + type: array + description: >- + The products that belong to this tax rate. Available if the relation + `products` is expanded. + items: + type: object + description: A product object. + product_types: + type: array + description: >- + The product types that belong to this tax rate. Available if the + relation `product_types` is expanded. + items: + type: object + description: A product type object. + shipping_options: + type: array + description: >- + The shipping options that belong to this tax rate. Available if the + relation `shipping_options` is expanded. + items: + type: object + description: A shipping option object. + product_count: + description: The count of products + type: integer + example: null + product_type_count: + description: The count of product types + type: integer + example: null + shipping_option_count: + description: The count of shipping options + type: integer + example: null + 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 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + tracking_link: + 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. + x-resourceId: tracking_link + required: + - tracking_number + - fulfillment_id + properties: + id: + type: string + description: The tracking link's ID + example: tlink_01G8ZH853Y6TFXWPG5EYE81X63 + url: + description: The URL at which the status of the shipment can be tracked. + type: string + format: uri + tracking_number: + description: The tracking number given by the shipping carrier. + type: string + format: RH370168054CN + fulfillment_id: + type: string + description: The id of the Fulfillment that the Tracking Link references. + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + fulfillment: + description: Available if the relation `fulfillment` is expanded. + $ref: '#/components/schemas/fulfillment' + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a process + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + 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 + user: + title: User + description: Represents a User who can manage store settings. + x-resourceId: user + required: + - email + properties: + id: + type: string + description: The user's ID + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + email: + description: The email of the User + type: string + format: email + first_name: + description: The first name of the User + type: string + example: Levi + last_name: + description: The last name of the User + type: string + example: Bogan + api_token: + description: An API token associated with the user. + type: string + example: null + 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 + multiple_errors: + title: Multiple Errors + x-resourceId: multiple_errors + 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 + x-resourceId: error + 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. diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index fcefe766f5..edd7c578fe 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -2,9 +2,19 @@ openapi: 3.0.0 info: version: 1.0.0 title: Medusa Storefront API - description: >- + description: > API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. + + + ## Authentication + + + To send requests as an authenticated customer, you must use the Cookie + Session ID. + + + license: name: MIT url: 'https://github.com/medusajs/medusa/blob/master/LICENSE' @@ -60,6 +70,32 @@ paths: Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser. parameters: [] + 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.auth.authenticate({ + email: 'user@example.com', + password: 'user@example.com' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/store/auth' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "email": "user@example.com", + "password": "supersecret" + }' tags: - Auth responses: @@ -71,6 +107,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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' requestBody: content: application/json: @@ -90,16 +138,62 @@ paths: operationId: DeleteAuth summary: Log out description: Destroys a Customer's authenticated session. + x-authenticated: true + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request DELETE 'https://medusa-url.com/store/auth' + \ + + --header 'Cookie: connect.sid={sid}' + security: + - 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 Session description: Gets the currently logged in Customer. x-authenticated: true + 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 + + medusa.auth.getSession() + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/store/auth' \ + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] tags: - Auth responses: @@ -111,8 +205,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '400': + $ref: '#/components/responses/400_error' '401': - description: Unauthorized + $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/{email}': get: operationId: GetAuthEmail @@ -126,6 +230,23 @@ paths: format: email required: true description: The email to check if exists. + 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.auth.exists('user@example.com') + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/auth/user@example.com' \ + + --header 'Cookie: connect.sid={sid}' tags: - Auth responses: @@ -138,13 +259,21 @@ paths: exists: type: boolean description: Whether email exists or not. + '400': + $ref: '#/components/responses/400_error' + '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' '/carts/{id}/shipping-methods': post: operationId: PostCartsCartShippingMethod description: Adds a Shipping Method to the Cart. summary: Add a Shipping Method - tags: - - Cart parameters: - in: path name: id @@ -152,6 +281,35 @@ paths: description: The cart ID. 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 }) + + medusa.carts.addShippingMethod(cart_id, { + option_id + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/shipping-methods' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "option_id": "{option_id}", + }' + tags: + - Cart responses: '200': description: OK @@ -161,6 +319,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' requestBody: content: application/json: @@ -193,6 +361,12 @@ paths: description: The Cart ID. schema: type: string + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/taxes' tags: - Cart responses: @@ -204,6 +378,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' '/carts/{id}/complete': post: summary: Complete a Cart @@ -222,6 +406,25 @@ paths: description: The Cart id. 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 }) + + medusa.carts.complete(cart_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/complete' tags: - Cart responses: @@ -269,6 +472,16 @@ paths: properties: cart: $ref: '#/components/schemas/swap' + '400': + $ref: '#/components/responses/400_error' + '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' /carts: post: summary: Create a Cart @@ -326,6 +539,24 @@ paths: example: ip: '::1' user_agent: Chrome + 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.carts.create() + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/store/carts' tags: - Cart responses: @@ -337,6 +568,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' '/carts/{id}/line-items': post: operationId: PostCartsCartLineItems @@ -351,6 +592,35 @@ paths: description: The id of the Cart to add the Line Item to. 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 }) + + medusa.carts.lineItems.create(cart_id, { + variant_id, + quantity: 1 + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/line-items' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "variant_id": "{variant_id}", + "quantity": 1 + }' tags: - Cart responses: @@ -362,6 +632,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' requestBody: content: application/json: @@ -398,6 +678,25 @@ paths: description: The id of the Cart. 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 }) + + medusa.carts.createPaymentSessions(cart_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions' tags: - Cart responses: @@ -409,6 +708,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' '/carts/{id}/discounts/{code}': delete: operationId: DeleteCartsCartDiscountsDiscount @@ -427,6 +736,25 @@ paths: description: The unique Discount code. 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 }) + + medusa.carts.deleteDiscount(cart_id, code) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/carts/{id}/discounts/{code}' tags: - Cart responses: @@ -438,6 +766,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' '/carts/{id}/line-items/{line_id}': delete: operationId: DeleteCartsCartLineItemsItem @@ -456,6 +794,25 @@ paths: description: The id of the Line Item. 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 }) + + medusa.carts.lineItems.delete(cart_id, line_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' tags: - Cart responses: @@ -467,6 +824,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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: PostCartsCartLineItemsItem summary: Update a Line Item @@ -484,6 +851,33 @@ paths: description: The id of the Line Item. 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 }) + + medusa.carts.lineItems.update(cart_id, line_id, { + quantity: 1 + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "quantity": 1 + }' tags: - Cart responses: @@ -495,6 +889,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' requestBody: content: application/json: @@ -528,6 +932,25 @@ paths: be deleted. 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 }) + + medusa.carts.deletePaymentSession(cart_id, 'manual') + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' tags: - Cart responses: @@ -539,6 +962,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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: PostCartsCartPaymentSessionUpdate summary: Update a Payment Session @@ -556,6 +989,34 @@ paths: description: The id of the payment provider. 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 }) + + medusa.carts.updatePaymentSession(cart_id, 'manual', { + data: { + } + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "data": {} + }' tags: - Cart responses: @@ -567,6 +1028,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' requestBody: content: application/json: @@ -590,6 +1061,25 @@ paths: description: The id of the Cart. 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 }) + + medusa.carts.retrieve(cart_id) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/carts/{id}' tags: - Cart responses: @@ -601,6 +1091,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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: PostCartsCart summary: Update a Cart @@ -677,6 +1177,33 @@ paths: example: ip: '::1' user_agent: Chrome + 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.carts.update(cart_id, { + email: 'user@example.com' + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' tags: - Cart responses: @@ -688,6 +1215,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' '/carts/{id}/payment-sessions/{provider_id}/refresh': post: operationId: PostCartsCartPaymentSessionsSession @@ -710,6 +1247,25 @@ paths: be refreshed. 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 }) + + medusa.carts.refreshPaymentSession(cart_id, 'manual') + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual/refresh' tags: - Cart responses: @@ -721,6 +1277,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' '/carts/{id}/payment-session': post: operationId: PostCartsCartPaymentSession @@ -735,6 +1301,33 @@ paths: description: The ID of the Cart. 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 }) + + medusa.carts.setPaymentSession(cart_id, { + provider_id: 'manual' + }) + + .then(({ cart }) => { + console.log(cart.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/carts/{id}/payment-sessions' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "provider_id": "manual" + }' tags: - Cart responses: @@ -746,6 +1339,16 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + '400': + $ref: '#/components/responses/400_error' + '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' requestBody: content: application/json: @@ -769,6 +1372,25 @@ paths: description: The id of the Product Collection 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 }) + + medusa.collections.retrieve(collection_id) + + .then(({ collection }) => { + console.log(collection.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/collections/{id}' tags: - Collection responses: @@ -780,6 +1402,16 @@ paths: properties: collection: $ref: '#/components/schemas/product_collection' + '400': + $ref: '#/components/responses/400_error' + '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: get: operationId: GetCollections @@ -844,6 +1476,25 @@ paths: type: string description: filter by dates greater than or equal to this date format: date + 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.collections.list() + + .then(({ collections, limit, offset, count }) => { + console.log(collections.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/collections' tags: - Collection responses: @@ -866,6 +1517,16 @@ paths: limit: type: integer description: The number of items per page + '400': + $ref: '#/components/responses/400_error' + '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/me/addresses: post: operationId: PostCustomersCustomerAddresses @@ -883,6 +1544,58 @@ paths: description: The Address to add to the Customer. anyOf: - $ref: '#/components/schemas/address' + 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 + + medusa.customers.addresses.addAddress({ + address: { + first_name: 'Celia', + last_name: 'Schumm', + address_1: '225 Bednar Curve', + city: 'Danielville', + country_code: 'US', + postal_code: '85137', + phone: '981-596-6748 x90188', + company: 'Wyman LLC', + address_2: '', + province: 'Georgia', + metadata: {} + } + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me/addresses' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "address": { + "first_name": "Celia", + "last_name": "Schumm", + "address_1": "225 Bednar Curve", + "city": "Danielville", + "country_code": "US", + "postal_code": "85137" + } + }' + security: + - cookie_auth: [] tags: - Customer responses: @@ -894,6 +1607,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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 @@ -926,6 +1651,39 @@ paths: phone: description: The Customer's phone number. 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 }) + + medusa.customers.create({ + first_name: 'Alec', + last_name: 'Reynolds', + email: 'user@example.com', + password: 'supersecret' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Alec", + "last_name": "Reynolds", + "email": "user@example.com", + "password": "supersecret" + }' tags: - Customer responses: @@ -937,6 +1695,12 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' '422': description: A customer with the same email exists content: @@ -958,6 +1722,8 @@ paths: message: >- A customer with the given email already has an account. Log in instead + '500': + $ref: '#/components/responses/500_error' '/customers/me/addresses/{address_id}': delete: operationId: DeleteCustomersCustomerAddressesAddress @@ -971,6 +1737,31 @@ paths: description: The id of the Address to remove. 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 + + medusa.customers.addresses.deleteAddress(address_id) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] tags: - Customer responses: @@ -982,6 +1773,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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: PostCustomersCustomerAddressesAddress summary: Update a Shipping Address @@ -1000,6 +1803,39 @@ paths: schema: anyOf: - $ref: '#/components/schemas/address' + 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 + + medusa.customers.addresses.updateAddress(address_id, { + first_name: 'Gina' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Gina" + }' + security: + - cookie_auth: [] tags: - Customer responses: @@ -1011,6 +1847,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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/me: get: operationId: GetCustomersCustomer @@ -1019,6 +1867,31 @@ paths: Retrieves a Customer - the Customer must be logged in to retrieve their details. x-authenticated: true + 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 + + medusa.customers.retrieve() + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] tags: - Customer responses: @@ -1030,6 +1903,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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 Customer details @@ -1065,6 +1950,39 @@ paths: metadata: description: Metadata about the customer. type: object + 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 + + medusa.customers.update({ + first_name: 'Laury' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Laury" + }' + security: + - cookie_auth: [] tags: - Customer responses: @@ -1076,6 +1994,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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/me/payment-methods: get: operationId: GetCustomersCustomerPaymentMethods @@ -1085,6 +2015,31 @@ paths: are saved with Payment Providers and it is their responsibility to fetch saved methods. x-authenticated: true + 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 + + medusa.customers.paymentMethods.list() + + .then(({ payment_methods }) => { + console.log(payment_methods.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me/payment-methods' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] tags: - Customer responses: @@ -1108,6 +2063,18 @@ paths: description: >- The data needed for the Payment Provider to use the saved payment method. + '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/me/orders: get: operationId: GetCustomersCustomerOrders @@ -1274,6 +2241,31 @@ paths: resulting orders. 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 + + medusa.customers.listOrders() + + .then(({ orders, limit, offset, count }) => { + console.log(orders); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me/orders' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] tags: - Customer responses: @@ -1296,6 +2288,18 @@ paths: limit: type: integer description: The number of items per page + '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/password-token: post: operationId: PostCustomersCustomerPasswordToken @@ -1315,11 +2319,54 @@ paths: description: The email of the customer. type: string format: email + 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.customers.generatePasswordToken({ + email: 'user@example.com' + }) + + .then(() => { + // successful + }) + + .catch(() => { + // failed + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/password-token' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' tags: - Customer 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' /customers/password-reset: post: operationId: PostCustomersResetPassword @@ -1347,6 +2394,37 @@ paths: token: description: The reset password token 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 }) + + medusa.customers.resetPassword({ + email: 'user@example.com', + password: 'supersecret', + token: 'supersecrettoken' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/password-reset' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com", + "password": "supersecret", + "token": "supersecrettoken" + }' tags: - Customer responses: @@ -1358,6 +2436,18 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '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/{code}': get: operationId: GetGiftCardsCode @@ -1370,6 +2460,25 @@ paths: description: The unique Gift Card code. 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 }) + + medusa.giftCards.retrieve(code) + + .then(({ gift_card }) => { + console.log(gift_card.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/gift-cards/{code}' tags: - Gift Card responses: @@ -1381,6 +2490,16 @@ paths: properties: gift_card: $ref: '#/components/schemas/gift_card' + '400': + $ref: '#/components/responses/400_error' + '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/cart/{cart_id}': get: operationId: GetOrdersOrderCartId @@ -1395,6 +2514,25 @@ paths: description: The ID of Cart. 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 }) + + medusa.orders.retrieveByCartId(cart_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders/cart/{id}' tags: - Order responses: @@ -1406,6 +2544,16 @@ paths: properties: order: $ref: '#/components/schemas/order' + '400': + $ref: '#/components/responses/400_error' + '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 @@ -1418,6 +2566,25 @@ paths: description: The id of the Order. 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 }) + + medusa.orders.retrieve(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders/{id}' tags: - Order responses: @@ -1429,6 +2596,16 @@ paths: properties: order: $ref: '#/components/schemas/order' + '400': + $ref: '#/components/responses/400_error' + '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 @@ -1461,6 +2638,28 @@ paths: postal_code: type: string description: The postal code of the shipping address + 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.orders.lookupOrder({ + display_id: 1, + email: 'user@example.com' + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders?display_id=1&email=user@example.com' tags: - Order responses: @@ -1472,6 +2671,16 @@ paths: properties: order: $ref: '#/components/schemas/order' + '400': + $ref: '#/components/responses/400_error' + '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}': get: operationId: GetProductsProduct @@ -1484,6 +2693,25 @@ paths: description: The id of the Product. 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 }) + + medusa.products.retrieve(product_id) + + .then(({ product }) => { + console.log(product.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/products/{id}' tags: - Product responses: @@ -1495,6 +2723,16 @@ paths: properties: product: $ref: '#/components/schemas/product' + '400': + $ref: '#/components/responses/400_error' + '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: get: operationId: GetProducts @@ -1632,6 +2870,25 @@ paths: the result. 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 }) + + medusa.products.list() + + .then(({ products, limit, offset, count }) => { + console.log(products.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/products' tags: - Product responses: @@ -1654,9 +2911,19 @@ paths: limit: type: integer description: The number of items per page + '400': + $ref: '#/components/responses/400_error' + '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/search: - get: - operationId: GetProductsSearch + post: + operationId: PostProductsSearch summary: Search Products description: >- Run a search query on products using the search engine installed on @@ -1678,6 +2945,27 @@ paths: description: Limit the number of products returned. schema: type: integer + 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.products.search({ + q: 'Shirt' + }) + + .then(({ hits }) => { + console.log(hits.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/products/search?q=Shirt' tags: - Product responses: @@ -1692,6 +2980,16 @@ paths: description: >- Array of results. The format of the items depends on the search engine installed on the server. + '400': + $ref: '#/components/responses/400_error' + '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}': get: operationId: GetRegionsRegion @@ -1704,6 +3002,25 @@ paths: description: The id of the Region. 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 }) + + medusa.regions.retrieve(region_id) + + .then(({ region }) => { + console.log(region.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/regions/{id}' tags: - Region responses: @@ -1715,6 +3032,16 @@ paths: properties: region: $ref: '#/components/schemas/region' + '400': + $ref: '#/components/responses/400_error' + '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: get: operationId: GetRegions @@ -1777,6 +3104,24 @@ paths: type: string description: filter by dates greater than or equal to this date format: date + 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.regions.list() + + .then(({ regions }) => { + console.log(regions.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/store/regions' tags: - Region responses: @@ -1790,6 +3135,16 @@ paths: type: array items: $ref: '#/components/schemas/region' + '400': + $ref: '#/components/responses/400_error' + '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}': get: operationId: GetReturnReasonsReason @@ -1802,6 +3157,25 @@ paths: description: The id of the Return Reason. 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 }) + + medusa.returnReasons.retrieve(reason_id) + + .then(({ return_reason }) => { + console.log(return_reason.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/return-reasons/{id}' tags: - Return Reason responses: @@ -1813,11 +3187,40 @@ paths: properties: return_reason: $ref: '#/components/schemas/return_reason' + '400': + $ref: '#/components/responses/400_error' + '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: get: operationId: GetReturnReasons summary: List Return Reasons description: Retrieves a list of Return Reasons. + 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.returnReasons.list() + + .then(({ return_reasons }) => { + console.log(return_reasons.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/return-reasons' tags: - Return Reason responses: @@ -1831,6 +3234,16 @@ paths: type: array items: $ref: '#/components/schemas/return_reason' + '400': + $ref: '#/components/responses/400_error' + '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: post: operationId: PostReturns @@ -1881,6 +3294,45 @@ paths: description: >- The ID of the Shipping Option to create the Shipping Method from. + 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.returns.create({ + order_id, + items: [ + { + item_id, + quantity: 1 + } + ] + }) + + .then(({ return }) => { + console.log(return.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/returns' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "order_id": "asfasf", + "items": [ + { + "item_id": "assfasf", + "quantity": 1 + } + ] + }' tags: - Return responses: @@ -1892,6 +3344,16 @@ paths: properties: return: $ref: '#/components/schemas/return' + '400': + $ref: '#/components/responses/400_error' + '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: get: operationId: GetShippingOptions @@ -1915,6 +3377,25 @@ paths: description: the Region to retrieve Shipping Options from. 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 }) + + medusa.shippingOptions.list() + + .then(({ shipping_options }) => { + console.log(shipping_options.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/shipping-options' tags: - Shipping Option responses: @@ -1928,6 +3409,16 @@ paths: type: array items: $ref: '#/components/schemas/shipping_option' + '400': + $ref: '#/components/responses/400_error' + '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/{cart_id}': get: operationId: GetShippingOptionsCartId @@ -1940,6 +3431,25 @@ paths: description: The id of the Cart. 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 }) + + medusa.shippingOptions.listCartOptions(cart_id) + + .then(({ shipping_options }) => { + console.log(shipping_options.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/shipping-options/{cart_id}' tags: - Shipping Option responses: @@ -1953,6 +3463,16 @@ paths: type: array items: $ref: '#/components/schemas/shipping_option' + '400': + $ref: '#/components/responses/400_error' + '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: post: operationId: PostSwaps @@ -2011,6 +3531,57 @@ paths: quantity: description: The quantity to send of the variant. type: integer + 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.swaps.create({ + order_id, + return_items: [ + { + item_id, + quantity: 1 + } + ], + additional_items: [ + { + variant_id, + quantity: 1 + } + ] + }) + + .then(({ swap }) => { + console.log(swap.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST 'https://medusa-url.com/store/swaps' + \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "order_id": "asfasf", + "return_items": [ + { + "item_id": "asfas", + "quantity": 1 + } + ], + "additional_items": [ + { + "variant_id": "asfas", + "quantity": 1 + } + ] + }' tags: - Swap responses: @@ -2022,6 +3593,16 @@ paths: properties: swap: $ref: '#/components/schemas/swap' + '400': + $ref: '#/components/responses/400_error' + '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/{cart_id}': get: operationId: GetSwapsSwapCartId @@ -2034,6 +3615,25 @@ paths: description: The id of the Cart 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 }) + + medusa.swaps.retrieveByCartId(cart_id) + + .then(({ swap }) => { + console.log(swap.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/swaps/{cart_id}' tags: - Swap responses: @@ -2045,6 +3645,16 @@ paths: properties: swap: $ref: '#/components/schemas/swap' + '400': + $ref: '#/components/responses/400_error' + '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/{variant_id}': get: operationId: GetVariantsVariant @@ -2077,6 +3687,12 @@ paths: externalDocs: url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' description: See a list of codes. + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/variants/{id}' tags: - Product Variant responses: @@ -2088,6 +3704,16 @@ paths: properties: variant: $ref: '#/components/schemas/product_variant' + '400': + $ref: '#/components/responses/400_error' + '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 @@ -2155,6 +3781,12 @@ paths: description: >- filter by inventory quantity greater than or equal to this number + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/variants' tags: - Product Variant responses: @@ -2168,7 +3800,216 @@ paths: type: array items: $ref: '#/components/schemas/product_variant' + '400': + $ref: '#/components/responses/400_error' + '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/multiple_errors' + examples: + not_allowed: + $ref: '#/components/examples/not_allowed_error' + invalid_data: + $ref: '#/components/examples/invalid_data_error' + multiple_errors: + $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: + cookie_auth: + type: apiKey + x-displayName: Cookie Session ID + in: cookie + name: connect.sid + 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 customer 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 + customer](#tag/Auth/operation/PostAuth) and pass the cURL option `-v`: + + + ```bash + + curl -v --location --request POST 'https://medusa-url.com/store/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/store/customers/me/orders' \ + + --header 'Cookie: connect.sid={sid}' + + ``` + + + Where `{sid}` is the value of `connect.sid` that you copied. schemas: address: title: Address @@ -7079,3 +8920,30 @@ components: description: An optional key-value map with additional details example: car: white + multiple_errors: + title: Multiple Errors + x-resourceId: multiple_errors + 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 + x-resourceId: error + 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. diff --git a/docs/api/store/code_samples/JavaScript/auth/getundefined b/docs/api/store/code_samples/JavaScript/auth/getundefined new file mode 100644 index 0000000000..0c21313927 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/auth/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.auth.getSession() +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/auth/postundefined b/docs/api/store/code_samples/JavaScript/auth/postundefined new file mode 100644 index 0000000000..fe1dd9d1d0 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/auth/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.auth.authenticate({ + email: 'user@example.com', + password: 'user@example.com' +}) +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/auth_{email}/getundefined b/docs/api/store/code_samples/JavaScript/auth_{email}/getundefined new file mode 100644 index 0000000000..7a47fb4b7d --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/auth_{email}/getundefined @@ -0,0 +1,3 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.auth.exists('user@example.com') diff --git a/docs/api/store/code_samples/JavaScript/carts/postundefined b/docs/api/store/code_samples/JavaScript/carts/postundefined new file mode 100644 index 0000000000..2c436be865 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts/postundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.create() +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}/getundefined b/docs/api/store/code_samples/JavaScript/carts_{id}/getundefined new file mode 100644 index 0000000000..3f5adbd0ee --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.retrieve(cart_id) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}/postundefined new file mode 100644 index 0000000000..ae0a9ac7ce --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}/postundefined @@ -0,0 +1,8 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.update(cart_id, { + email: 'user@example.com' +}) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_complete/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_complete/postundefined new file mode 100644 index 0000000000..c6d5cef0bc --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_complete/postundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.complete(cart_id) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_discounts_{code}/deleteundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_discounts_{code}/deleteundefined new file mode 100644 index 0000000000..d75cb36b38 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_discounts_{code}/deleteundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.deleteDiscount(cart_id, code) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_line-items/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_line-items/postundefined new file mode 100644 index 0000000000..094d7dbd04 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_line-items/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.lineItems.create(cart_id, { + variant_id, + quantity: 1 +}) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_line-items_{line_id}/deleteundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_line-items_{line_id}/deleteundefined new file mode 100644 index 0000000000..239701d366 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_line-items_{line_id}/deleteundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.lineItems.delete(cart_id, line_id) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_line-items_{line_id}/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_line-items_{line_id}/postundefined new file mode 100644 index 0000000000..aa81978a10 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_line-items_{line_id}/postundefined @@ -0,0 +1,8 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.lineItems.update(cart_id, line_id, { + quantity: 1 +}) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_payment-session/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-session/postundefined new file mode 100644 index 0000000000..107071e321 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-session/postundefined @@ -0,0 +1,8 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.setPaymentSession(cart_id, { + provider_id: 'manual' +}) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions/postundefined new file mode 100644 index 0000000000..e762a5d1d6 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions/postundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.createPaymentSessions(cart_id) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/deleteundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/deleteundefined new file mode 100644 index 0000000000..fe32566f08 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/deleteundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.deletePaymentSession(cart_id, 'manual') +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/postundefined new file mode 100644 index 0000000000..21e0253c2c --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.updatePaymentSession(cart_id, 'manual', { + data: { + } +}) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined new file mode 100644 index 0000000000..e106394882 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.refreshPaymentSession(cart_id, 'manual') +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/carts_{id}_shipping-methods/postundefined b/docs/api/store/code_samples/JavaScript/carts_{id}_shipping-methods/postundefined new file mode 100644 index 0000000000..92be47414d --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/carts_{id}_shipping-methods/postundefined @@ -0,0 +1,8 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.carts.addShippingMethod(cart_id, { + option_id +}) +.then(({ cart }) => { + console.log(cart.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/collections/getundefined b/docs/api/store/code_samples/JavaScript/collections/getundefined new file mode 100644 index 0000000000..9b59fa07a1 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/collections/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.collections.list() +.then(({ collections, limit, offset, count }) => { + console.log(collections.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/collections_{id}/getundefined b/docs/api/store/code_samples/JavaScript/collections_{id}/getundefined new file mode 100644 index 0000000000..c57b33a1e7 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/collections_{id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.collections.retrieve(collection_id) +.then(({ collection }) => { + console.log(collection.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers/postundefined b/docs/api/store/code_samples/JavaScript/customers/postundefined new file mode 100644 index 0000000000..cdf5ba83bc --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.customers.create({ + first_name: 'Alec', + last_name: 'Reynolds', + email: 'user@example.com', + password: 'supersecret' +}) +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_me/getundefined b/docs/api/store/code_samples/JavaScript/customers_me/getundefined new file mode 100644 index 0000000000..eddbee9d38 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_me/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.customers.retrieve() +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_me/postundefined b/docs/api/store/code_samples/JavaScript/customers_me/postundefined new file mode 100644 index 0000000000..c37ca4d74c --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_me/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.customers.update({ + first_name: 'Laury' +}) +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_me_addresses/postundefined b/docs/api/store/code_samples/JavaScript/customers_me_addresses/postundefined new file mode 100644 index 0000000000..3a3d7d0f19 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_me_addresses/postundefined @@ -0,0 +1,21 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.customers.addresses.addAddress({ + address: { + first_name: 'Celia', + last_name: 'Schumm', + address_1: '225 Bednar Curve', + city: 'Danielville', + country_code: 'US', + postal_code: '85137', + phone: '981-596-6748 x90188', + company: 'Wyman LLC', + address_2: '', + province: 'Georgia', + metadata: {} + } +}) +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_me_addresses_{address_id}/deleteundefined b/docs/api/store/code_samples/JavaScript/customers_me_addresses_{address_id}/deleteundefined new file mode 100644 index 0000000000..2b722339b5 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_me_addresses_{address_id}/deleteundefined @@ -0,0 +1,7 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.customers.addresses.deleteAddress(address_id) +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_me_addresses_{address_id}/postundefined b/docs/api/store/code_samples/JavaScript/customers_me_addresses_{address_id}/postundefined new file mode 100644 index 0000000000..1ebe44d14d --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_me_addresses_{address_id}/postundefined @@ -0,0 +1,9 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.customers.addresses.updateAddress(address_id, { + first_name: 'Gina' +}) +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_me_orders/getundefined b/docs/api/store/code_samples/JavaScript/customers_me_orders/getundefined new file mode 100644 index 0000000000..1261f01cd2 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_me_orders/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.customers.listOrders() +.then(({ orders, limit, offset, count }) => { + console.log(orders); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_me_payment-methods/getundefined b/docs/api/store/code_samples/JavaScript/customers_me_payment-methods/getundefined new file mode 100644 index 0000000000..aab15b677f --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_me_payment-methods/getundefined @@ -0,0 +1,7 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +// must be previously logged +medusa.customers.paymentMethods.list() +.then(({ payment_methods }) => { + console.log(payment_methods.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_password-reset/postundefined b/docs/api/store/code_samples/JavaScript/customers_password-reset/postundefined new file mode 100644 index 0000000000..2367e38c9b --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_password-reset/postundefined @@ -0,0 +1,10 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.customers.resetPassword({ + email: 'user@example.com', + password: 'supersecret', + token: 'supersecrettoken' +}) +.then(({ customer }) => { + console.log(customer.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/customers_password-token/postundefined b/docs/api/store/code_samples/JavaScript/customers_password-token/postundefined new file mode 100644 index 0000000000..3273ee4fb0 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/customers_password-token/postundefined @@ -0,0 +1,11 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.customers.generatePasswordToken({ + email: 'user@example.com' +}) +.then(() => { + // successful +}) +.catch(() => { + // failed +}) diff --git a/docs/api/store/code_samples/JavaScript/gift-cards_{code}/getundefined b/docs/api/store/code_samples/JavaScript/gift-cards_{code}/getundefined new file mode 100644 index 0000000000..32ce72e3e2 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/gift-cards_{code}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.giftCards.retrieve(code) +.then(({ gift_card }) => { + console.log(gift_card.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/orders/getundefined b/docs/api/store/code_samples/JavaScript/orders/getundefined new file mode 100644 index 0000000000..4eb5ea5d67 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/orders/getundefined @@ -0,0 +1,9 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.orders.lookupOrder({ + display_id: 1, + email: 'user@example.com' +}) +.then(({ order }) => { + console.log(order.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/orders_cart_{cart_id}/getundefined b/docs/api/store/code_samples/JavaScript/orders_cart_{cart_id}/getundefined new file mode 100644 index 0000000000..2318153197 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/orders_cart_{cart_id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.orders.retrieveByCartId(cart_id) +.then(({ order }) => { + console.log(order.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/orders_{id}/getundefined b/docs/api/store/code_samples/JavaScript/orders_{id}/getundefined new file mode 100644 index 0000000000..4698ecf018 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/orders_{id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.orders.retrieve(order_id) +.then(({ order }) => { + console.log(order.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/products/getundefined b/docs/api/store/code_samples/JavaScript/products/getundefined new file mode 100644 index 0000000000..8b497d740a --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/products/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.products.list() +.then(({ products, limit, offset, count }) => { + console.log(products.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/products_search/postundefined b/docs/api/store/code_samples/JavaScript/products_search/postundefined new file mode 100644 index 0000000000..74c0fcefbf --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/products_search/postundefined @@ -0,0 +1,8 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.products.search({ + q: 'Shirt' +}) +.then(({ hits }) => { + console.log(hits.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/products_{id}/getundefined b/docs/api/store/code_samples/JavaScript/products_{id}/getundefined new file mode 100644 index 0000000000..cae2281bb8 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/products_{id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.products.retrieve(product_id) +.then(({ product }) => { + console.log(product.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/regions/getundefined b/docs/api/store/code_samples/JavaScript/regions/getundefined new file mode 100644 index 0000000000..80c115fa9f --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/regions/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.regions.list() +.then(({ regions }) => { + console.log(regions.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/regions_{id}/getundefined b/docs/api/store/code_samples/JavaScript/regions_{id}/getundefined new file mode 100644 index 0000000000..9a54ea3f82 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/regions_{id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.regions.retrieve(region_id) +.then(({ region }) => { + console.log(region.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/return-reasons/getundefined b/docs/api/store/code_samples/JavaScript/return-reasons/getundefined new file mode 100644 index 0000000000..35c674e9a7 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/return-reasons/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.returnReasons.list() +.then(({ return_reasons }) => { + console.log(return_reasons.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/return-reasons_{id}/getundefined b/docs/api/store/code_samples/JavaScript/return-reasons_{id}/getundefined new file mode 100644 index 0000000000..a1f180d6e0 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/return-reasons_{id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.returnReasons.retrieve(reason_id) +.then(({ return_reason }) => { + console.log(return_reason.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/returns/postundefined b/docs/api/store/code_samples/JavaScript/returns/postundefined new file mode 100644 index 0000000000..412b0fff65 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/returns/postundefined @@ -0,0 +1,14 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.returns.create({ + order_id, + items: [ + { + item_id, + quantity: 1 + } + ] +}) +.then(({ return }) => { + console.log(return.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/shipping-options/getundefined b/docs/api/store/code_samples/JavaScript/shipping-options/getundefined new file mode 100644 index 0000000000..d2230ea4fc --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/shipping-options/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.shippingOptions.list() +.then(({ shipping_options }) => { + console.log(shipping_options.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/shipping-options_{cart_id}/getundefined b/docs/api/store/code_samples/JavaScript/shipping-options_{cart_id}/getundefined new file mode 100644 index 0000000000..f9c335af6a --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/shipping-options_{cart_id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.shippingOptions.listCartOptions(cart_id) +.then(({ shipping_options }) => { + console.log(shipping_options.length); +}); diff --git a/docs/api/store/code_samples/JavaScript/swaps/postundefined b/docs/api/store/code_samples/JavaScript/swaps/postundefined new file mode 100644 index 0000000000..8bb8aacc34 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/swaps/postundefined @@ -0,0 +1,20 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.swaps.create({ + order_id, + return_items: [ + { + item_id, + quantity: 1 + } + ], + additional_items: [ + { + variant_id, + quantity: 1 + } + ] +}) +.then(({ swap }) => { + console.log(swap.id); +}); diff --git a/docs/api/store/code_samples/JavaScript/swaps_{cart_id}/getundefined b/docs/api/store/code_samples/JavaScript/swaps_{cart_id}/getundefined new file mode 100644 index 0000000000..f01c35da41 --- /dev/null +++ b/docs/api/store/code_samples/JavaScript/swaps_{cart_id}/getundefined @@ -0,0 +1,6 @@ +import Medusa from "@medusajs/medusa-js" +const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) +medusa.swaps.retrieveByCartId(cart_id) +.then(({ swap }) => { + console.log(swap.id); +}); diff --git a/docs/api/store/code_samples/Shell/auth/deleteundefined b/docs/api/store/code_samples/Shell/auth/deleteundefined new file mode 100644 index 0000000000..57af41ea72 --- /dev/null +++ b/docs/api/store/code_samples/Shell/auth/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/store/auth' \ +--header 'Cookie: connect.sid={sid}' diff --git a/docs/api/store/code_samples/Shell/auth/getundefined b/docs/api/store/code_samples/Shell/auth/getundefined new file mode 100644 index 0000000000..4b522129cb --- /dev/null +++ b/docs/api/store/code_samples/Shell/auth/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/store/auth' \ +--header 'Cookie: connect.sid={sid}' diff --git a/docs/api/store/code_samples/Shell/auth/postundefined b/docs/api/store/code_samples/Shell/auth/postundefined new file mode 100644 index 0000000000..f35d447286 --- /dev/null +++ b/docs/api/store/code_samples/Shell/auth/postundefined @@ -0,0 +1,6 @@ +curl --location --request POST 'https://medusa-url.com/store/auth' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "email": "user@example.com", + "password": "supersecret" +}' diff --git a/docs/api/store/code_samples/Shell/auth_{email}/getundefined b/docs/api/store/code_samples/Shell/auth_{email}/getundefined new file mode 100644 index 0000000000..091d9550bf --- /dev/null +++ b/docs/api/store/code_samples/Shell/auth_{email}/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/store/auth/user@example.com' \ +--header 'Cookie: connect.sid={sid}' diff --git a/docs/api/store/code_samples/Shell/carts/postundefined b/docs/api/store/code_samples/Shell/carts/postundefined new file mode 100644 index 0000000000..a3099b3313 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts/postundefined @@ -0,0 +1 @@ +curl --location --request POST 'https://medusa-url.com/store/carts' diff --git a/docs/api/store/code_samples/Shell/carts_{id}/getundefined b/docs/api/store/code_samples/Shell/carts_{id}/getundefined new file mode 100644 index 0000000000..76955da49d --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/carts/{id}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}/postundefined b/docs/api/store/code_samples/Shell/carts_{id}/postundefined new file mode 100644 index 0000000000..0ac6b61b04 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}/postundefined @@ -0,0 +1,5 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "email": "user@example.com" +}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_complete/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_complete/postundefined new file mode 100644 index 0000000000..9f219793bc --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_complete/postundefined @@ -0,0 +1 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/complete' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_discounts_{code}/deleteundefined b/docs/api/store/code_samples/Shell/carts_{id}_discounts_{code}/deleteundefined new file mode 100644 index 0000000000..66c40764e9 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_discounts_{code}/deleteundefined @@ -0,0 +1 @@ +curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/discounts/{code}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_line-items/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_line-items/postundefined new file mode 100644 index 0000000000..b2501c8d06 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_line-items/postundefined @@ -0,0 +1,6 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/line-items' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "variant_id": "{variant_id}", + "quantity": 1 +}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_line-items_{line_id}/deleteundefined b/docs/api/store/code_samples/Shell/carts_{id}_line-items_{line_id}/deleteundefined new file mode 100644 index 0000000000..ab5e4a252b --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_line-items_{line_id}/deleteundefined @@ -0,0 +1 @@ +curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_line-items_{line_id}/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_line-items_{line_id}/postundefined new file mode 100644 index 0000000000..ec45835403 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_line-items_{line_id}/postundefined @@ -0,0 +1,5 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "quantity": 1 +}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_payment-session/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_payment-session/postundefined new file mode 100644 index 0000000000..298a4d5134 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_payment-session/postundefined @@ -0,0 +1,5 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "provider_id": "manual" +}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions/postundefined new file mode 100644 index 0000000000..db8d6448a4 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions/postundefined @@ -0,0 +1 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/deleteundefined b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/deleteundefined new file mode 100644 index 0000000000..103cc5206d --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/deleteundefined @@ -0,0 +1 @@ +curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/postundefined new file mode 100644 index 0000000000..87714529b5 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/postundefined @@ -0,0 +1,5 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "data": {} +}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined new file mode 100644 index 0000000000..b8c4233e82 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined @@ -0,0 +1 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual/refresh' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_shipping-methods/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_shipping-methods/postundefined new file mode 100644 index 0000000000..cc15f640df --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_shipping-methods/postundefined @@ -0,0 +1,5 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/shipping-methods' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "option_id": "{option_id}", +}' diff --git a/docs/api/store/code_samples/Shell/carts_{id}_taxes/postundefined b/docs/api/store/code_samples/Shell/carts_{id}_taxes/postundefined new file mode 100644 index 0000000000..75e50772f7 --- /dev/null +++ b/docs/api/store/code_samples/Shell/carts_{id}_taxes/postundefined @@ -0,0 +1 @@ +curl --location --request POST 'https://medusa-url.com/store/carts/{id}/taxes' diff --git a/docs/api/store/code_samples/Shell/collections/getundefined b/docs/api/store/code_samples/Shell/collections/getundefined new file mode 100644 index 0000000000..ad7979b616 --- /dev/null +++ b/docs/api/store/code_samples/Shell/collections/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/collections' diff --git a/docs/api/store/code_samples/Shell/collections_{id}/getundefined b/docs/api/store/code_samples/Shell/collections_{id}/getundefined new file mode 100644 index 0000000000..3b322d611f --- /dev/null +++ b/docs/api/store/code_samples/Shell/collections_{id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/collections/{id}' diff --git a/docs/api/store/code_samples/Shell/customers/postundefined b/docs/api/store/code_samples/Shell/customers/postundefined new file mode 100644 index 0000000000..e38ed51c09 --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers/postundefined @@ -0,0 +1,8 @@ +curl --location --request POST 'https://medusa-url.com/store/customers' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "first_name": "Alec", + "last_name": "Reynolds", + "email": "user@example.com", + "password": "supersecret" +}' diff --git a/docs/api/store/code_samples/Shell/customers_me/getundefined b/docs/api/store/code_samples/Shell/customers_me/getundefined new file mode 100644 index 0000000000..5c7447f1f4 --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_me/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/store/customers/me' \ +--header 'Cookie: connect.sid={sid}' diff --git a/docs/api/store/code_samples/Shell/customers_me/postundefined b/docs/api/store/code_samples/Shell/customers_me/postundefined new file mode 100644 index 0000000000..7fee8f1d18 --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_me/postundefined @@ -0,0 +1,6 @@ +curl --location --request POST 'https://medusa-url.com/store/customers/me' \ +--header 'Cookie: connect.sid={sid}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "first_name": "Laury" +}' diff --git a/docs/api/store/code_samples/Shell/customers_me_addresses/postundefined b/docs/api/store/code_samples/Shell/customers_me_addresses/postundefined new file mode 100644 index 0000000000..b09ba84e2c --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_me_addresses/postundefined @@ -0,0 +1,13 @@ +curl --location --request POST 'https://medusa-url.com/store/customers/me/addresses' \ +--header 'Cookie: connect.sid={sid}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "address": { + "first_name": "Celia", + "last_name": "Schumm", + "address_1": "225 Bednar Curve", + "city": "Danielville", + "country_code": "US", + "postal_code": "85137" + } +}' diff --git a/docs/api/store/code_samples/Shell/customers_me_addresses_{address_id}/deleteundefined b/docs/api/store/code_samples/Shell/customers_me_addresses_{address_id}/deleteundefined new file mode 100644 index 0000000000..e0248069d7 --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_me_addresses_{address_id}/deleteundefined @@ -0,0 +1,2 @@ +curl --location --request DELETE 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ +--header 'Cookie: connect.sid={sid}' diff --git a/docs/api/store/code_samples/Shell/customers_me_addresses_{address_id}/postundefined b/docs/api/store/code_samples/Shell/customers_me_addresses_{address_id}/postundefined new file mode 100644 index 0000000000..4e9a361fe5 --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_me_addresses_{address_id}/postundefined @@ -0,0 +1,6 @@ +curl --location --request POST 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ +--header 'Cookie: connect.sid={sid}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "first_name": "Gina" +}' diff --git a/docs/api/store/code_samples/Shell/customers_me_orders/getundefined b/docs/api/store/code_samples/Shell/customers_me_orders/getundefined new file mode 100644 index 0000000000..86bc5700cd --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_me_orders/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/store/customers/me/orders' \ +--header 'Cookie: connect.sid={sid}' diff --git a/docs/api/store/code_samples/Shell/customers_me_payment-methods/getundefined b/docs/api/store/code_samples/Shell/customers_me_payment-methods/getundefined new file mode 100644 index 0000000000..d3b31353b5 --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_me_payment-methods/getundefined @@ -0,0 +1,2 @@ +curl --location --request GET 'https://medusa-url.com/store/customers/me/payment-methods' \ +--header 'Cookie: connect.sid={sid}' diff --git a/docs/api/store/code_samples/Shell/customers_password-reset/postundefined b/docs/api/store/code_samples/Shell/customers_password-reset/postundefined new file mode 100644 index 0000000000..7c283ab21c --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_password-reset/postundefined @@ -0,0 +1,7 @@ +curl --location --request POST 'https://medusa-url.com/store/customers/password-reset' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "email": "user@example.com", + "password": "supersecret", + "token": "supersecrettoken" +}' diff --git a/docs/api/store/code_samples/Shell/customers_password-token/postundefined b/docs/api/store/code_samples/Shell/customers_password-token/postundefined new file mode 100644 index 0000000000..1d363fa361 --- /dev/null +++ b/docs/api/store/code_samples/Shell/customers_password-token/postundefined @@ -0,0 +1,5 @@ +curl --location --request POST 'https://medusa-url.com/store/customers/password-token' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "email": "user@example.com" +}' diff --git a/docs/api/store/code_samples/Shell/gift-cards_{code}/getundefined b/docs/api/store/code_samples/Shell/gift-cards_{code}/getundefined new file mode 100644 index 0000000000..2332d07e61 --- /dev/null +++ b/docs/api/store/code_samples/Shell/gift-cards_{code}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/gift-cards/{code}' diff --git a/docs/api/store/code_samples/Shell/orders/getundefined b/docs/api/store/code_samples/Shell/orders/getundefined new file mode 100644 index 0000000000..983b8c826d --- /dev/null +++ b/docs/api/store/code_samples/Shell/orders/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/orders?display_id=1&email=user@example.com' diff --git a/docs/api/store/code_samples/Shell/orders_cart_{cart_id}/getundefined b/docs/api/store/code_samples/Shell/orders_cart_{cart_id}/getundefined new file mode 100644 index 0000000000..94c6dea6c0 --- /dev/null +++ b/docs/api/store/code_samples/Shell/orders_cart_{cart_id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/orders/cart/{id}' diff --git a/docs/api/store/code_samples/Shell/orders_{id}/getundefined b/docs/api/store/code_samples/Shell/orders_{id}/getundefined new file mode 100644 index 0000000000..2010e19cf3 --- /dev/null +++ b/docs/api/store/code_samples/Shell/orders_{id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/orders/{id}' diff --git a/docs/api/store/code_samples/Shell/products/getundefined b/docs/api/store/code_samples/Shell/products/getundefined new file mode 100644 index 0000000000..f2caa5c410 --- /dev/null +++ b/docs/api/store/code_samples/Shell/products/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/products' diff --git a/docs/api/store/code_samples/Shell/products_search/postundefined b/docs/api/store/code_samples/Shell/products_search/postundefined new file mode 100644 index 0000000000..acbe915089 --- /dev/null +++ b/docs/api/store/code_samples/Shell/products_search/postundefined @@ -0,0 +1 @@ +curl --location --request POST 'https://medusa-url.com/store/products/search?q=Shirt' diff --git a/docs/api/store/code_samples/Shell/products_{id}/getundefined b/docs/api/store/code_samples/Shell/products_{id}/getundefined new file mode 100644 index 0000000000..01e92bf292 --- /dev/null +++ b/docs/api/store/code_samples/Shell/products_{id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/products/{id}' diff --git a/docs/api/store/code_samples/Shell/regions/getundefined b/docs/api/store/code_samples/Shell/regions/getundefined new file mode 100644 index 0000000000..d768567fa2 --- /dev/null +++ b/docs/api/store/code_samples/Shell/regions/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/regions' diff --git a/docs/api/store/code_samples/Shell/regions_{id}/getundefined b/docs/api/store/code_samples/Shell/regions_{id}/getundefined new file mode 100644 index 0000000000..deb4970f93 --- /dev/null +++ b/docs/api/store/code_samples/Shell/regions_{id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/regions/{id}' diff --git a/docs/api/store/code_samples/Shell/return-reasons/getundefined b/docs/api/store/code_samples/Shell/return-reasons/getundefined new file mode 100644 index 0000000000..64d05b4425 --- /dev/null +++ b/docs/api/store/code_samples/Shell/return-reasons/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/return-reasons' diff --git a/docs/api/store/code_samples/Shell/return-reasons_{id}/getundefined b/docs/api/store/code_samples/Shell/return-reasons_{id}/getundefined new file mode 100644 index 0000000000..5a9d698343 --- /dev/null +++ b/docs/api/store/code_samples/Shell/return-reasons_{id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/return-reasons/{id}' diff --git a/docs/api/store/code_samples/Shell/returns/postundefined b/docs/api/store/code_samples/Shell/returns/postundefined new file mode 100644 index 0000000000..f34ac1925b --- /dev/null +++ b/docs/api/store/code_samples/Shell/returns/postundefined @@ -0,0 +1,11 @@ +curl --location --request POST 'https://medusa-url.com/store/returns' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "order_id": "asfasf", + "items": [ + { + "item_id": "assfasf", + "quantity": 1 + } + ] +}' diff --git a/docs/api/store/code_samples/Shell/shipping-options/getundefined b/docs/api/store/code_samples/Shell/shipping-options/getundefined new file mode 100644 index 0000000000..12818d8ed7 --- /dev/null +++ b/docs/api/store/code_samples/Shell/shipping-options/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/shipping-options' diff --git a/docs/api/store/code_samples/Shell/shipping-options_{cart_id}/getundefined b/docs/api/store/code_samples/Shell/shipping-options_{cart_id}/getundefined new file mode 100644 index 0000000000..b7b747f9f9 --- /dev/null +++ b/docs/api/store/code_samples/Shell/shipping-options_{cart_id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/shipping-options/{cart_id}' diff --git a/docs/api/store/code_samples/Shell/swaps/postundefined b/docs/api/store/code_samples/Shell/swaps/postundefined new file mode 100644 index 0000000000..14b03ca379 --- /dev/null +++ b/docs/api/store/code_samples/Shell/swaps/postundefined @@ -0,0 +1,17 @@ +curl --location --request POST 'https://medusa-url.com/store/swaps' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "order_id": "asfasf", + "return_items": [ + { + "item_id": "asfas", + "quantity": 1 + } + ], + "additional_items": [ + { + "variant_id": "asfas", + "quantity": 1 + } + ] +}' diff --git a/docs/api/store/code_samples/Shell/swaps_{cart_id}/getundefined b/docs/api/store/code_samples/Shell/swaps_{cart_id}/getundefined new file mode 100644 index 0000000000..2b9aef474b --- /dev/null +++ b/docs/api/store/code_samples/Shell/swaps_{cart_id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/swaps/{cart_id}' diff --git a/docs/api/store/code_samples/Shell/variants/getundefined b/docs/api/store/code_samples/Shell/variants/getundefined new file mode 100644 index 0000000000..4568d2c137 --- /dev/null +++ b/docs/api/store/code_samples/Shell/variants/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/variants' diff --git a/docs/api/store/code_samples/Shell/variants_{variant_id}/getundefined b/docs/api/store/code_samples/Shell/variants_{variant_id}/getundefined new file mode 100644 index 0000000000..d9ca508004 --- /dev/null +++ b/docs/api/store/code_samples/Shell/variants_{variant_id}/getundefined @@ -0,0 +1 @@ +curl --location --request GET 'https://medusa-url.com/store/variants/{id}' diff --git a/docs/api/store/components/examples/database_error.yaml b/docs/api/store/components/examples/database_error.yaml new file mode 100644 index 0000000000..07f4ce82cb --- /dev/null +++ b/docs/api/store/components/examples/database_error.yaml @@ -0,0 +1,5 @@ +summary: Database Error +value: + code: api_error + message: An error occured while hashing password + type: database_error diff --git a/docs/api/store/components/examples/default_error.yaml b/docs/api/store/components/examples/default_error.yaml new file mode 100644 index 0000000000..b24cde7cd9 --- /dev/null +++ b/docs/api/store/components/examples/default_error.yaml @@ -0,0 +1,5 @@ +summary: Default Error +value: + code: unknown_error + message: An unknown error occurred. + type: unknown_error diff --git a/docs/api/store/components/examples/invalid_argument_error.yaml b/docs/api/store/components/examples/invalid_argument_error.yaml new file mode 100644 index 0000000000..364d93fde8 --- /dev/null +++ b/docs/api/store/components/examples/invalid_argument_error.yaml @@ -0,0 +1,4 @@ +summary: Invalid Argument Error +value: + message: cart.total must be defined + type: unexpected_state diff --git a/docs/api/store/components/examples/invalid_data_error.yaml b/docs/api/store/components/examples/invalid_data_error.yaml new file mode 100644 index 0000000000..62ea2f6f71 --- /dev/null +++ b/docs/api/store/components/examples/invalid_data_error.yaml @@ -0,0 +1,4 @@ +summary: Invalid Data Error +value: + message: first_name must be a string + type: invalid_data diff --git a/docs/api/store/components/examples/multiple_errors.yaml b/docs/api/store/components/examples/multiple_errors.yaml new file mode 100644 index 0000000000..044e062400 --- /dev/null +++ b/docs/api/store/components/examples/multiple_errors.yaml @@ -0,0 +1,10 @@ +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 diff --git a/docs/api/store/components/examples/not_allowed_error.yaml b/docs/api/store/components/examples/not_allowed_error.yaml new file mode 100644 index 0000000000..5388080633 --- /dev/null +++ b/docs/api/store/components/examples/not_allowed_error.yaml @@ -0,0 +1,4 @@ +summary: Not Allowed Error +value: + message: Discount must be set to dynamic + type: not_allowed diff --git a/docs/api/store/components/examples/unexpected_state_error.yaml b/docs/api/store/components/examples/unexpected_state_error.yaml new file mode 100644 index 0000000000..297e630dee --- /dev/null +++ b/docs/api/store/components/examples/unexpected_state_error.yaml @@ -0,0 +1,4 @@ +summary: Unexpected State Error +value: + message: cart.total must be defined + type: unexpected_state diff --git a/docs/api/store/components/responses/400_error.yaml b/docs/api/store/components/responses/400_error.yaml new file mode 100644 index 0000000000..95f25b376b --- /dev/null +++ b/docs/api/store/components/responses/400_error.yaml @@ -0,0 +1,14 @@ +description: Client Error or Multiple Errors +content: + application/json: + schema: + oneOf: + - $ref: ../schemas/error.yaml + - $ref: ../schemas/multiple_errors.yaml + examples: + not_allowed: + $ref: ../examples/not_allowed_error.yaml + invalid_data: + $ref: ../examples/invalid_data_error.yaml + multiple_errors: + $ref: ../examples/multiple_errors.yaml diff --git a/docs/api/store/components/responses/500_error.yaml b/docs/api/store/components/responses/500_error.yaml new file mode 100644 index 0000000000..ecb2e70917 --- /dev/null +++ b/docs/api/store/components/responses/500_error.yaml @@ -0,0 +1,14 @@ +description: Server Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + examples: + database: + $ref: ../examples/database_error.yaml + unexpected_state: + $ref: ../examples/unexpected_state_error.yaml + invalid_argument: + $ref: ../examples/invalid_argument_error.yaml + default_error: + $ref: ../examples/default_error.yaml diff --git a/docs/api/store/components/responses/default_error.yaml b/docs/api/store/components/responses/default_error.yaml new file mode 100644 index 0000000000..b7d6911d9d --- /dev/null +++ b/docs/api/store/components/responses/default_error.yaml @@ -0,0 +1,9 @@ +description: Default Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + code: unknown_error + message: An unknown error occurred. + type: unknown_error diff --git a/docs/api/store/components/responses/incorrect_credentials.yaml b/docs/api/store/components/responses/incorrect_credentials.yaml new file mode 100644 index 0000000000..c1537623ba --- /dev/null +++ b/docs/api/store/components/responses/incorrect_credentials.yaml @@ -0,0 +1,7 @@ +description: User does not exist or incorrect credentials +content: + text/plain: + schema: + type: string + default: Unauthorized + example: Unauthorized diff --git a/docs/api/store/components/responses/invalid_request_error.yaml b/docs/api/store/components/responses/invalid_request_error.yaml new file mode 100644 index 0000000000..4050c5fc89 --- /dev/null +++ b/docs/api/store/components/responses/invalid_request_error.yaml @@ -0,0 +1,9 @@ +description: Invalid Request Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + code: invalid_request_error + message: Discount with code TEST already exists. + type: duplicate_error diff --git a/docs/api/store/components/responses/invalid_state_error.yaml b/docs/api/store/components/responses/invalid_state_error.yaml new file mode 100644 index 0000000000..fbbf916749 --- /dev/null +++ b/docs/api/store/components/responses/invalid_state_error.yaml @@ -0,0 +1,11 @@ +description: Invalid State Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + code: unknown_error + message: >- + The request conflicted with another request. You may retry the request + with the provided Idempotency-Key. + type: QueryRunnerAlreadyReleasedError diff --git a/docs/api/store/components/responses/not_found_error.yaml b/docs/api/store/components/responses/not_found_error.yaml new file mode 100644 index 0000000000..667ae355c0 --- /dev/null +++ b/docs/api/store/components/responses/not_found_error.yaml @@ -0,0 +1,8 @@ +description: Not Found Error +content: + application/json: + schema: + $ref: ../schemas/error.yaml + example: + message: Entity with id 1 was not found + type: not_found diff --git a/docs/api/store/components/responses/unauthorized.yaml b/docs/api/store/components/responses/unauthorized.yaml new file mode 100644 index 0000000000..6e59a0886a --- /dev/null +++ b/docs/api/store/components/responses/unauthorized.yaml @@ -0,0 +1,7 @@ +description: User is not authorized. Must log in first +content: + text/plain: + schema: + type: string + default: Unauthorized + example: Unauthorized diff --git a/docs/api/store/components/schemas/error.yaml b/docs/api/store/components/schemas/error.yaml new file mode 100644 index 0000000000..c8baa14163 --- /dev/null +++ b/docs/api/store/components/schemas/error.yaml @@ -0,0 +1,12 @@ +title: Response Error +x-resourceId: error +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. diff --git a/docs/api/store/components/schemas/multiple_errors.yaml b/docs/api/store/components/schemas/multiple_errors.yaml new file mode 100644 index 0000000000..579282df2f --- /dev/null +++ b/docs/api/store/components/schemas/multiple_errors.yaml @@ -0,0 +1,13 @@ +title: Multiple Errors +x-resourceId: multiple_errors +properties: + errors: + type: array + description: Array of errors + items: + $ref: ./error.yaml + message: + type: string + default: >- + Provided request body contains errors. Please check the data and retry the + request diff --git a/docs/api/store/openapi.yaml b/docs/api/store/openapi.yaml index b90279095d..cdef601bef 100644 --- a/docs/api/store/openapi.yaml +++ b/docs/api/store/openapi.yaml @@ -2,9 +2,19 @@ openapi: 3.0.0 info: version: 1.0.0 title: Medusa Storefront API - description: >- + description: > API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. + + + ## Authentication + + + To send requests as an authenticated customer, you must use the Cookie + Session ID. + + + license: name: MIT url: https://github.com/medusajs/medusa/blob/master/LICENSE @@ -136,3 +146,71 @@ paths: $ref: paths/variants_{variant_id}.yaml /variants: $ref: paths/variants.yaml +components: + securitySchemes: + cookie_auth: + type: apiKey + x-displayName: Cookie Session ID + in: cookie + name: connect.sid + 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 customer 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 + customer](#tag/Auth/operation/PostAuth) and pass the cURL option `-v`: + + + ```bash + + curl -v --location --request POST 'https://medusa-url.com/store/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/store/customers/me/orders' \ + + --header 'Cookie: connect.sid={sid}' + + ``` + + + Where `{sid}` is the value of `connect.sid` that you copied. diff --git a/docs/api/store/paths/auth.yaml b/docs/api/store/paths/auth.yaml index 73909588ae..7fe783e9b3 100644 --- a/docs/api/store/paths/auth.yaml +++ b/docs/api/store/paths/auth.yaml @@ -5,6 +5,15 @@ post: Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser. parameters: [] + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/auth/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/auth/postundefined tags: - Auth responses: @@ -16,6 +25,18 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/incorrect_credentials.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: @@ -35,16 +56,47 @@ delete: operationId: DeleteAuth summary: Log out description: Destroys a Customer's authenticated session. + x-authenticated: true + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/auth/deleteundefined + security: + - cookie_auth: [] tags: - Auth responses: '200': description: OK + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml get: operationId: GetAuth summary: Get Session description: Gets the currently logged in Customer. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/auth/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/auth/getundefined + security: + - cookie_auth: [] tags: - Auth responses: @@ -56,5 +108,15 @@ get: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml '401': - description: Unauthorized + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/auth_{email}.yaml b/docs/api/store/paths/auth_{email}.yaml index 574126c113..61ef6fc0a9 100644 --- a/docs/api/store/paths/auth_{email}.yaml +++ b/docs/api/store/paths/auth_{email}.yaml @@ -10,6 +10,15 @@ get: format: email required: true description: The email to check if exists. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/auth_{email}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/auth_{email}/getundefined tags: - Auth responses: @@ -22,3 +31,13 @@ get: exists: type: boolean description: Whether email exists or not. + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/carts.yaml b/docs/api/store/paths/carts.yaml index 0c75e60b3b..a8c7080251 100644 --- a/docs/api/store/paths/carts.yaml +++ b/docs/api/store/paths/carts.yaml @@ -52,6 +52,15 @@ post: example: ip: '::1' user_agent: Chrome + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts/postundefined tags: - Cart responses: @@ -63,3 +72,13 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/carts_{id}.yaml b/docs/api/store/paths/carts_{id}.yaml index 469a20338c..dfde99182a 100644 --- a/docs/api/store/paths/carts_{id}.yaml +++ b/docs/api/store/paths/carts_{id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Cart. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}/getundefined tags: - Cart responses: @@ -20,6 +29,16 @@ get: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCartsCart summary: Update a Cart @@ -96,6 +115,15 @@ post: example: ip: '::1' user_agent: Chrome + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}/postundefined tags: - Cart responses: @@ -107,3 +135,13 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/carts_{id}_complete.yaml b/docs/api/store/paths/carts_{id}_complete.yaml index 9814feb4ff..66d7d45c11 100644 --- a/docs/api/store/paths/carts_{id}_complete.yaml +++ b/docs/api/store/paths/carts_{id}_complete.yaml @@ -15,6 +15,15 @@ post: description: The Cart id. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}_complete/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_complete/postundefined tags: - Cart responses: @@ -62,3 +71,13 @@ post: properties: cart: $ref: ../components/schemas/swap.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/carts_{id}_discounts_{code}.yaml b/docs/api/store/paths/carts_{id}_discounts_{code}.yaml index cdb4c10fe1..f24752530c 100644 --- a/docs/api/store/paths/carts_{id}_discounts_{code}.yaml +++ b/docs/api/store/paths/carts_{id}_discounts_{code}.yaml @@ -15,6 +15,15 @@ delete: description: The unique Discount code. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}_discounts_{code}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_discounts_{code}/deleteundefined tags: - Cart responses: @@ -26,3 +35,13 @@ delete: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/carts_{id}_line-items.yaml b/docs/api/store/paths/carts_{id}_line-items.yaml index b7ac4f1a36..ea30d1c05e 100644 --- a/docs/api/store/paths/carts_{id}_line-items.yaml +++ b/docs/api/store/paths/carts_{id}_line-items.yaml @@ -9,6 +9,15 @@ post: description: The id of the Cart to add the Line Item to. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}_line-items/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_line-items/postundefined tags: - Cart responses: @@ -20,6 +29,16 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: diff --git a/docs/api/store/paths/carts_{id}_line-items_{line_id}.yaml b/docs/api/store/paths/carts_{id}_line-items_{line_id}.yaml index de972a6909..c5b99c0a8f 100644 --- a/docs/api/store/paths/carts_{id}_line-items_{line_id}.yaml +++ b/docs/api/store/paths/carts_{id}_line-items_{line_id}.yaml @@ -15,6 +15,16 @@ delete: description: The id of the Line Item. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/carts_{id}_line-items_{line_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_line-items_{line_id}/deleteundefined tags: - Cart responses: @@ -26,6 +36,16 @@ delete: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCartsCartLineItemsItem summary: Update a Line Item @@ -43,6 +63,16 @@ post: description: The id of the Line Item. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/carts_{id}_line-items_{line_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_line-items_{line_id}/postundefined tags: - Cart responses: @@ -54,6 +84,16 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: diff --git a/docs/api/store/paths/carts_{id}_payment-session.yaml b/docs/api/store/paths/carts_{id}_payment-session.yaml index 8c545a6705..da3d34bb0f 100644 --- a/docs/api/store/paths/carts_{id}_payment-session.yaml +++ b/docs/api/store/paths/carts_{id}_payment-session.yaml @@ -11,6 +11,15 @@ post: description: The ID of the Cart. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}_payment-session/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_payment-session/postundefined tags: - Cart responses: @@ -22,6 +31,16 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: diff --git a/docs/api/store/paths/carts_{id}_payment-sessions.yaml b/docs/api/store/paths/carts_{id}_payment-sessions.yaml index e9c4b299a4..84993b436e 100644 --- a/docs/api/store/paths/carts_{id}_payment-sessions.yaml +++ b/docs/api/store/paths/carts_{id}_payment-sessions.yaml @@ -11,6 +11,15 @@ post: description: The id of the Cart. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}_payment-sessions/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_payment-sessions/postundefined tags: - Cart responses: @@ -22,3 +31,13 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}.yaml b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}.yaml index 138acff81e..2f1050b1aa 100644 --- a/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}.yaml +++ b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}.yaml @@ -17,6 +17,17 @@ delete: deleted. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/deleteundefined tags: - Cart responses: @@ -28,6 +39,16 @@ delete: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCartsCartPaymentSessionUpdate summary: Update a Payment Session @@ -45,6 +66,17 @@ post: description: The id of the payment provider. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/carts_{id}_payment-sessions_{provider_id}/postundefined tags: - Cart responses: @@ -56,6 +88,16 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: diff --git a/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml index b5a7de6600..4b78d36e4e 100644 --- a/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml +++ b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml @@ -19,6 +19,17 @@ post: refreshed. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/carts_{id}_payment-sessions_{provider_id}_refresh/postundefined tags: - Cart responses: @@ -30,3 +41,13 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/carts_{id}_shipping-methods.yaml b/docs/api/store/paths/carts_{id}_shipping-methods.yaml index 0ea9ae45fe..ec9a204346 100644 --- a/docs/api/store/paths/carts_{id}_shipping-methods.yaml +++ b/docs/api/store/paths/carts_{id}_shipping-methods.yaml @@ -2,8 +2,6 @@ post: operationId: PostCartsCartShippingMethod description: Adds a Shipping Method to the Cart. summary: Add a Shipping Method - tags: - - Cart parameters: - in: path name: id @@ -11,6 +9,17 @@ post: description: The cart ID. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/carts_{id}_shipping-methods/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_shipping-methods/postundefined + tags: + - Cart responses: '200': description: OK @@ -20,6 +29,16 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml requestBody: content: application/json: diff --git a/docs/api/store/paths/carts_{id}_taxes.yaml b/docs/api/store/paths/carts_{id}_taxes.yaml index e85afe3fde..e732ff5534 100644 --- a/docs/api/store/paths/carts_{id}_taxes.yaml +++ b/docs/api/store/paths/carts_{id}_taxes.yaml @@ -11,6 +11,11 @@ post: description: The Cart ID. schema: type: string + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/carts_{id}_taxes/postundefined tags: - Cart responses: @@ -22,3 +27,13 @@ post: properties: cart: $ref: ../components/schemas/cart.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/collections.yaml b/docs/api/store/paths/collections.yaml index 7b877a2093..6004098d7f 100644 --- a/docs/api/store/paths/collections.yaml +++ b/docs/api/store/paths/collections.yaml @@ -61,6 +61,15 @@ get: type: string description: filter by dates greater than or equal to this date format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/collections/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections/getundefined tags: - Collection responses: @@ -83,3 +92,13 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/collections_{id}.yaml b/docs/api/store/paths/collections_{id}.yaml index 94778954a4..86fccb3b21 100644 --- a/docs/api/store/paths/collections_{id}.yaml +++ b/docs/api/store/paths/collections_{id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Product Collection schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/collections_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/collections_{id}/getundefined tags: - Collection responses: @@ -20,3 +29,13 @@ get: properties: collection: $ref: ../components/schemas/product_collection.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers.yaml b/docs/api/store/paths/customers.yaml index 82a4f6e32e..ebdf37d9f1 100644 --- a/docs/api/store/paths/customers.yaml +++ b/docs/api/store/paths/customers.yaml @@ -29,6 +29,15 @@ post: phone: description: The Customer's phone number. type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers/postundefined tags: - Customer responses: @@ -40,6 +49,12 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml '422': description: A customer with the same email exists content: @@ -61,3 +76,5 @@ post: message: >- A customer with the given email already has an account. Log in instead + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers_me.yaml b/docs/api/store/paths/customers_me.yaml index 239dd92c9d..abaf7c4ef7 100644 --- a/docs/api/store/paths/customers_me.yaml +++ b/docs/api/store/paths/customers_me.yaml @@ -5,6 +5,17 @@ get: Retrieves a Customer - the Customer must be logged in to retrieve their details. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_me/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_me/getundefined + security: + - cookie_auth: [] tags: - Customer responses: @@ -16,6 +27,18 @@ get: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCustomersCustomer summary: Update Customer details @@ -51,6 +74,17 @@ post: metadata: description: Metadata about the customer. type: object + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_me/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_me/postundefined + security: + - cookie_auth: [] tags: - Customer responses: @@ -62,3 +96,15 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers_me_addresses.yaml b/docs/api/store/paths/customers_me_addresses.yaml index 852fa74b76..75f59ca824 100644 --- a/docs/api/store/paths/customers_me_addresses.yaml +++ b/docs/api/store/paths/customers_me_addresses.yaml @@ -14,6 +14,17 @@ post: description: The Address to add to the Customer. anyOf: - $ref: ../components/schemas/address.yaml + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_me_addresses/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_me_addresses/postundefined + security: + - cookie_auth: [] tags: - Customer responses: @@ -25,3 +36,15 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers_me_addresses_{address_id}.yaml b/docs/api/store/paths/customers_me_addresses_{address_id}.yaml index e8c248228f..62966310a5 100644 --- a/docs/api/store/paths/customers_me_addresses_{address_id}.yaml +++ b/docs/api/store/paths/customers_me_addresses_{address_id}.yaml @@ -10,6 +10,19 @@ delete: description: The id of the Address to remove. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/customers_me_addresses_{address_id}/deleteundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/customers_me_addresses_{address_id}/deleteundefined + security: + - cookie_auth: [] tags: - Customer responses: @@ -21,6 +34,18 @@ delete: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml post: operationId: PostCustomersCustomerAddressesAddress summary: Update a Shipping Address @@ -39,6 +64,19 @@ post: schema: anyOf: - $ref: ../components/schemas/address.yaml + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: >- + ../code_samples/JavaScript/customers_me_addresses_{address_id}/postundefined + - lang: Shell + label: cURL + source: + $ref: >- + ../code_samples/Shell/customers_me_addresses_{address_id}/postundefined + security: + - cookie_auth: [] tags: - Customer responses: @@ -50,3 +88,15 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers_me_orders.yaml b/docs/api/store/paths/customers_me_orders.yaml index 2e2dd744cf..da28497178 100644 --- a/docs/api/store/paths/customers_me_orders.yaml +++ b/docs/api/store/paths/customers_me_orders.yaml @@ -163,6 +163,17 @@ get: resulting orders. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_me_orders/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_me_orders/getundefined + security: + - cookie_auth: [] tags: - Customer responses: @@ -185,3 +196,15 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers_me_payment-methods.yaml b/docs/api/store/paths/customers_me_payment-methods.yaml index ed8fd4e188..ab884bac9d 100644 --- a/docs/api/store/paths/customers_me_payment-methods.yaml +++ b/docs/api/store/paths/customers_me_payment-methods.yaml @@ -6,6 +6,17 @@ get: saved with Payment Providers and it is their responsibility to fetch saved methods. x-authenticated: true + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_me_payment-methods/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_me_payment-methods/getundefined + security: + - cookie_auth: [] tags: - Customer responses: @@ -29,3 +40,15 @@ get: description: >- The data needed for the Payment Provider to use the saved payment method. + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers_password-reset.yaml b/docs/api/store/paths/customers_password-reset.yaml index e882f146a2..14d0d17789 100644 --- a/docs/api/store/paths/customers_password-reset.yaml +++ b/docs/api/store/paths/customers_password-reset.yaml @@ -24,6 +24,15 @@ post: token: description: The reset password token type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_password-reset/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_password-reset/postundefined tags: - Customer responses: @@ -35,3 +44,15 @@ post: properties: customer: $ref: ../components/schemas/customer.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/customers_password-token.yaml b/docs/api/store/paths/customers_password-token.yaml index 1b46ffaa2f..c3db3579e7 100644 --- a/docs/api/store/paths/customers_password-token.yaml +++ b/docs/api/store/paths/customers_password-token.yaml @@ -16,8 +16,29 @@ post: description: The email of the customer. type: string format: email + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/customers_password-token/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/customers_password-token/postundefined tags: - Customer responses: '204': description: OK + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/gift-cards_{code}.yaml b/docs/api/store/paths/gift-cards_{code}.yaml index 296239263e..e712e2a460 100644 --- a/docs/api/store/paths/gift-cards_{code}.yaml +++ b/docs/api/store/paths/gift-cards_{code}.yaml @@ -9,6 +9,15 @@ get: description: The unique Gift Card code. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/gift-cards_{code}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/gift-cards_{code}/getundefined tags: - Gift Card responses: @@ -20,3 +29,13 @@ get: properties: gift_card: $ref: ../components/schemas/gift_card.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/orders.yaml b/docs/api/store/paths/orders.yaml index 6922c2a3b8..c8149d9397 100644 --- a/docs/api/store/paths/orders.yaml +++ b/docs/api/store/paths/orders.yaml @@ -29,6 +29,15 @@ get: postal_code: type: string description: The postal code of the shipping address + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders/getundefined tags: - Order responses: @@ -40,3 +49,13 @@ get: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/orders_cart_{cart_id}.yaml b/docs/api/store/paths/orders_cart_{cart_id}.yaml index a5fb52acb1..bfdb7b0326 100644 --- a/docs/api/store/paths/orders_cart_{cart_id}.yaml +++ b/docs/api/store/paths/orders_cart_{cart_id}.yaml @@ -9,6 +9,15 @@ get: description: The ID of Cart. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_cart_{cart_id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_cart_{cart_id}/getundefined tags: - Order responses: @@ -20,3 +29,13 @@ get: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/orders_{id}.yaml b/docs/api/store/paths/orders_{id}.yaml index adb4dbe44b..7a7521b2e9 100644 --- a/docs/api/store/paths/orders_{id}.yaml +++ b/docs/api/store/paths/orders_{id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Order. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/orders_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/orders_{id}/getundefined tags: - Order responses: @@ -20,3 +29,13 @@ get: properties: order: $ref: ../components/schemas/order.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/products.yaml b/docs/api/store/paths/products.yaml index 008dc45eae..4599ce3663 100644 --- a/docs/api/store/paths/products.yaml +++ b/docs/api/store/paths/products.yaml @@ -134,6 +134,15 @@ get: result. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products/getundefined tags: - Product responses: @@ -156,3 +165,13 @@ get: limit: type: integer description: The number of items per page + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/products_search.yaml b/docs/api/store/paths/products_search.yaml index 614fdbc630..3510f063d9 100644 --- a/docs/api/store/paths/products_search.yaml +++ b/docs/api/store/paths/products_search.yaml @@ -1,5 +1,5 @@ -get: - operationId: GetProductsSearch +post: + operationId: PostProductsSearch summary: Search Products description: Run a search query on products using the search engine installed on Medusa parameters: @@ -19,6 +19,15 @@ get: description: Limit the number of products returned. schema: type: integer + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_search/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_search/postundefined tags: - Product responses: @@ -33,3 +42,13 @@ get: description: >- Array of results. The format of the items depends on the search engine installed on the server. + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/products_{id}.yaml b/docs/api/store/paths/products_{id}.yaml index 4e376e3315..633e1d2461 100644 --- a/docs/api/store/paths/products_{id}.yaml +++ b/docs/api/store/paths/products_{id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Product. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/products_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/products_{id}/getundefined tags: - Product responses: @@ -20,3 +29,13 @@ get: properties: product: $ref: ../components/schemas/product.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/regions.yaml b/docs/api/store/paths/regions.yaml index d70a5a3a70..54a8b669c6 100644 --- a/docs/api/store/paths/regions.yaml +++ b/docs/api/store/paths/regions.yaml @@ -59,6 +59,15 @@ get: type: string description: filter by dates greater than or equal to this date format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions/getundefined tags: - Region responses: @@ -72,3 +81,13 @@ get: type: array items: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/regions_{id}.yaml b/docs/api/store/paths/regions_{id}.yaml index b2a7c48a89..a2c43565eb 100644 --- a/docs/api/store/paths/regions_{id}.yaml +++ b/docs/api/store/paths/regions_{id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Region. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/regions_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/regions_{id}/getundefined tags: - Region responses: @@ -20,3 +29,13 @@ get: properties: region: $ref: ../components/schemas/region.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/return-reasons.yaml b/docs/api/store/paths/return-reasons.yaml index dfbe03397a..b7e2f66cfd 100644 --- a/docs/api/store/paths/return-reasons.yaml +++ b/docs/api/store/paths/return-reasons.yaml @@ -2,6 +2,15 @@ get: operationId: GetReturnReasons summary: List Return Reasons description: Retrieves a list of Return Reasons. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/return-reasons/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/return-reasons/getundefined tags: - Return Reason responses: @@ -15,3 +24,13 @@ get: type: array items: $ref: ../components/schemas/return_reason.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/return-reasons_{id}.yaml b/docs/api/store/paths/return-reasons_{id}.yaml index 431029a501..570d5be72e 100644 --- a/docs/api/store/paths/return-reasons_{id}.yaml +++ b/docs/api/store/paths/return-reasons_{id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Return Reason. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/return-reasons_{id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/return-reasons_{id}/getundefined tags: - Return Reason responses: @@ -20,3 +29,13 @@ get: properties: return_reason: $ref: ../components/schemas/return_reason.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/returns.yaml b/docs/api/store/paths/returns.yaml index e30279072b..1681832a2f 100644 --- a/docs/api/store/paths/returns.yaml +++ b/docs/api/store/paths/returns.yaml @@ -47,6 +47,15 @@ post: description: >- The ID of the Shipping Option to create the Shipping Method from. + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/returns/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/returns/postundefined tags: - Return responses: @@ -58,3 +67,13 @@ post: properties: return: $ref: ../components/schemas/return.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/shipping-options.yaml b/docs/api/store/paths/shipping-options.yaml index 66ca720e0b..bcb7fd8b9f 100644 --- a/docs/api/store/paths/shipping-options.yaml +++ b/docs/api/store/paths/shipping-options.yaml @@ -20,6 +20,15 @@ get: description: the Region to retrieve Shipping Options from. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-options/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-options/getundefined tags: - Shipping Option responses: @@ -33,3 +42,13 @@ get: type: array items: $ref: ../components/schemas/shipping_option.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/shipping-options_{cart_id}.yaml b/docs/api/store/paths/shipping-options_{cart_id}.yaml index 61172ac00e..20a69c2ee1 100644 --- a/docs/api/store/paths/shipping-options_{cart_id}.yaml +++ b/docs/api/store/paths/shipping-options_{cart_id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Cart. schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/shipping-options_{cart_id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/shipping-options_{cart_id}/getundefined tags: - Shipping Option responses: @@ -22,3 +31,13 @@ get: type: array items: $ref: ../components/schemas/shipping_option.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/swaps.yaml b/docs/api/store/paths/swaps.yaml index e45b4b9296..39bbdd3fc5 100644 --- a/docs/api/store/paths/swaps.yaml +++ b/docs/api/store/paths/swaps.yaml @@ -55,6 +55,15 @@ post: quantity: description: The quantity to send of the variant. type: integer + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/swaps/postundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/swaps/postundefined tags: - Swap responses: @@ -66,3 +75,13 @@ post: properties: swap: $ref: ../components/schemas/swap.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/swaps_{cart_id}.yaml b/docs/api/store/paths/swaps_{cart_id}.yaml index f09da0dd81..e8eba0fdf0 100644 --- a/docs/api/store/paths/swaps_{cart_id}.yaml +++ b/docs/api/store/paths/swaps_{cart_id}.yaml @@ -9,6 +9,15 @@ get: description: The id of the Cart schema: type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: + $ref: ../code_samples/JavaScript/swaps_{cart_id}/getundefined + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/swaps_{cart_id}/getundefined tags: - Swap responses: @@ -20,3 +29,13 @@ get: properties: swap: $ref: ../components/schemas/swap.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/variants.yaml b/docs/api/store/paths/variants.yaml index 5274287ccd..45793e78b3 100644 --- a/docs/api/store/paths/variants.yaml +++ b/docs/api/store/paths/variants.yaml @@ -62,6 +62,11 @@ get: description: >- filter by inventory quantity greater than or equal to this number + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/variants/getundefined tags: - Product Variant responses: @@ -75,3 +80,13 @@ get: type: array items: $ref: ../components/schemas/product_variant.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/api/store/paths/variants_{variant_id}.yaml b/docs/api/store/paths/variants_{variant_id}.yaml index 842293367f..e31cc21f04 100644 --- a/docs/api/store/paths/variants_{variant_id}.yaml +++ b/docs/api/store/paths/variants_{variant_id}.yaml @@ -29,6 +29,11 @@ get: externalDocs: url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes description: See a list of codes. + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/variants_{variant_id}/getundefined tags: - Product Variant responses: @@ -40,3 +45,13 @@ get: properties: variant: $ref: ../components/schemas/product_variant.yaml + '400': + $ref: ../components/responses/400_error.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/docs/content/quickstart/quick-start.md b/docs/content/quickstart/quick-start.md index c9ce689630..fc03f23359 100644 --- a/docs/content/quickstart/quick-start.md +++ b/docs/content/quickstart/quick-start.md @@ -79,7 +79,7 @@ You can learn more about configuring your server and loading environment variabl ## What's next :rocket: -- Install our [Next.js](../starters/nextjs-medusa-starter) or [Gatsby](../starters/gatsby-medusa-starter) storefronts to set up your ecommerce storefront quickly. +- Install our [Next.js](../starters/nextjs-medusa-starter.md) or [Gatsby](../starters/gatsby-medusa-starter.md) storefronts to set up your ecommerce storefront quickly. - Install the [Medusa Admin](../admin/quickstart.md) to supercharge your ecommerce experience with easy access to configurations and features. - Check out the [API reference](https://docs.medusajs.com/api/store) to learn more about available endpoints available on your Medusa server. - Install [plugins](https://github.com/medusajs/medusa/tree/master/packages) for features like Payment, CMS, Notifications, among other features. diff --git a/docs/content/user-guide/customers/_category_.json b/docs/content/user-guide/customers/_category_.json new file mode 100644 index 0000000000..dd5f8fc1d0 --- /dev/null +++ b/docs/content/user-guide/customers/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 5, + "collapsed": false, + "link": null, + "label": "Customers" +} \ No newline at end of file diff --git a/docs/content/user-guide/customers/groups.md b/docs/content/user-guide/customers/groups.md new file mode 100644 index 0000000000..f0e75f3646 --- /dev/null +++ b/docs/content/user-guide/customers/groups.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 3 +--- + +# Manage Customer Groups + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/customers/index.md b/docs/content/user-guide/customers/index.md new file mode 100644 index 0000000000..4d48d1a50d --- /dev/null +++ b/docs/content/user-guide/customers/index.md @@ -0,0 +1,36 @@ +--- +sidebar_position: 1 +--- + +# Customers Overview + +In this document, you’ll get an overview of the customer listing page and all the things you can do with it. + +## Overview + +You can find the list of signed up customers on your store in the Customers page. For each of those customers, you can view details such as their orders, or personal information. + +Part of the Customers domain is also Customer Groups. Customer groups allow you to put together a set of customers for business purposes. For example, you can create a VIP customer group for customers that you want to give special discounts. + +--- + +## View List of Customers + +You can view the list of available customers in your ecommerce store by clicking on Customers from the sidebar menu. + +In the list, you can see customer details such as the customer’s name, email address, and the number of orders. + +--- + +## View List of Customer Groups + +You can view the list of customer groups on the Customer Groups page by clicking on the grey Groups headline next to the Customers headline. + +In the list, you can see group details such as the group’s title and the number of customers in the group. + +--- + +## Learn More About Customers + +- [Manage and View a Customer’s Details](./manage.md) +- [Manage and View a Customer Group](./groups.md) diff --git a/docs/content/user-guide/customers/index.mdx b/docs/content/user-guide/customers/index.mdx deleted file mode 100644 index 794b2d85f9..0000000000 --- a/docs/content/user-guide/customers/index.mdx +++ /dev/null @@ -1,54 +0,0 @@ -import UiIcon from '@site/src/components/UiIcon'; - -# Customers Overview - -In this document, you’ll get an overview of the customer listing page and all the things you can do with it. - -## View List of Customers - -You can view the list of available customers in your ecommerce store by clicking on Customers from the sidebar menu. - -![Customers List](https://i.imgur.com/VXclXqd.png) - -In the list, you can see customer details such as the customer’s name, email address, and the number of orders. - -:::tip - -If there are more than 15 customers, the list will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. - -::: - -## View List of Customer Groups - -Customer groups allow you to put together a set of customers for business purposes. For example, you can create a VIP customer group for customers that you want to give special discounts. - -You can view the list of customer groups on the Customer Groups page by clicking on the grey Groups headline next to the Customers headline. - -![Customer Groups List](https://i.imgur.com/z1nEvhX.png) - -In the list, you can see group details such as the group’s title and the number of customers in the group. - -:::tip - -If there are more than 15 customer groups, the list will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. - -::: - -## Search Customers - -You can search for customers by clicking the icon at the top right of the customer list. When you search for customers, you search by their first name, last name, and email. - -![Search customers by name](https://i.imgur.com/c0IFMej.png) - -## Search Customer Groups - -You can search for customer groups by clicking the icon at the top right of the group list. When you search groups, you search by the customer group’s title. - -![Search customer groups by title](https://i.imgur.com/aksN5eW.png) - -## What More Can you Do with Customers? - -The Customers pages in the Medusa Admin include many functionalities including: - -- Manage and View a Customer’s Details -- Manage and View a Customer Group \ No newline at end of file diff --git a/docs/content/user-guide/customers/manage.md b/docs/content/user-guide/customers/manage.md new file mode 100644 index 0000000000..35b3716cf5 --- /dev/null +++ b/docs/content/user-guide/customers/manage.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 2 +--- + +# Manage Customers + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/discounts/_category_.json b/docs/content/user-guide/discounts/_category_.json new file mode 100644 index 0000000000..32c942c4f0 --- /dev/null +++ b/docs/content/user-guide/discounts/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 6, + "collapsed": false, + "link": null, + "label": "Discounts" +} \ No newline at end of file diff --git a/docs/content/user-guide/discounts/conditions.md b/docs/content/user-guide/discounts/conditions.md new file mode 100644 index 0000000000..7186f78c19 --- /dev/null +++ b/docs/content/user-guide/discounts/conditions.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 2 +--- + +# Discount Conditions Overview + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/discounts/create.md b/docs/content/user-guide/discounts/create.md new file mode 100644 index 0000000000..dc1d12b904 --- /dev/null +++ b/docs/content/user-guide/discounts/create.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 3 +--- + +# Create a Discount + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/discounts/edit.md b/docs/content/user-guide/discounts/edit.md new file mode 100644 index 0000000000..1074bfbc01 --- /dev/null +++ b/docs/content/user-guide/discounts/edit.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 4 +--- + +# Edit a Discount + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/discounts/index.md b/docs/content/user-guide/discounts/index.md new file mode 100644 index 0000000000..abda7015fd --- /dev/null +++ b/docs/content/user-guide/discounts/index.md @@ -0,0 +1,35 @@ +--- +sidebar_position: 1 +--- + +# Discounts Overview + +In this document, you’ll get an overview of the customer listing page and everything you can do with it. + +## Overview + +You can create discounts of different types in Medusa that customers use on checkout: + +- **Percentage Discounts** to deduct a percentage of the total amount of an order. +- **Fixed Discounts** to deduct a fixed amount from the total amount of an order. +- **Free Shipping** to override the delivery amount of an order and make it free. + +Discounts are in the form of a code that your customers can use. You can set options for a discount such as a start and an end date. + +You can also specify conditions for discounts, such as applying them for specific products or shipping options. + +--- + +## View List of Discounts + +You can view the list of available discounts in your ecommerce store by clicking on Discounts from the sidebar menu. + +In the list, you can see discount details such as the code, description, amount, and status. + +--- + +## Learn More About Discounts + +- [Discount Conditions Overview](./conditions.md) +- [Create a Discount](./create.md) +- [Edit a Discount](./edit.md) diff --git a/docs/content/user-guide/discounts/index.mdx b/docs/content/user-guide/discounts/index.mdx deleted file mode 100644 index 46c9b723c5..0000000000 --- a/docs/content/user-guide/discounts/index.mdx +++ /dev/null @@ -1,88 +0,0 @@ -import UiIcon from '@site/src/components/UiIcon'; - -# Discounts Overview - -In this document, you’ll get an overview of the customer listing page and all the things you can do with it. - -## View List of Discounts - -You can view the list of available discounts in your ecommerce store by clicking on Discounts from the sidebar menu. - -![Discounts List](https://i.imgur.com/buJGt36.png) - -In the list, you can see discount details such as the code, description, amount, and status. - -:::tip - -If there are more than 15 discounts, the list will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. - -::: - -## Filter Discounts - -You can use filters to retrieve only discounts matching specific criteria. - -### Advanced Filters - -You can use advanced filters to limit the discounts shown based on specific criteria. For example, you can filter discounts to only show dynamic discounts. - -To use advanced filters: - -- Click on the icon next to Filters. This will toggle a dropdown with categories for different fields. -- You can click on a field name to expand it and choose a filter for that field. -- Click on the Apply button at the top of the dropdown. - -This will retrieve the discount based on the filters you’ve selected. - -![Advanced filters dropdown with more than one filter selected](https://i.imgur.com/LWPMXG5.png) - -### Save Advanced Filters as Quick Filters - -If there are filters that you need to use frequently, you can give the set of filters a name and save them to be used later. For example, you can save the filters used in the previous example as “Normal Discounts”. - -To save an advanced filter: - -- Click on the icon next to Filters. -- Choose your filters from the dropdown. -- Choose a name for the filters in the input at the end of the dropdown. -- Click the Save button. - -![Give the filters a name and click Save](https://i.imgur.com/HjVMQG4.png) - -Once you click Save, you should see the new filter you added next to the Quick Filters at the top of the products list. - -![Saved Filter shows as a quick filter](https://i.imgur.com/Kycxtny.png) - -To apply a saved quick filter, just click on it. - -### Delete Saved Quick Filters - -You can delete any saved filter you’ve created. To do that, simply click on the icon next to the quick filter’s name, and it will be deleted. - -### Clear Filters - -To clear all applied filters: - -- Click on the icon next to Filters. -- Click on the Clear button. - -![Click clear button in the advanced filters dropdown](https://i.imgur.com/98ms0U2.png) - -:::info - -Clearing filters does not delete saved quick filters. You can still apply them by clicking on them. - -::: - -## Search Discounts - -You can search for discounts by clicking the icon at the top right of the discounts list. When you search for discounts, you search by discount codes. - -![Search discounts by code](https://i.imgur.com/zab2oqp.png) - -## What More Can you Do with Discounts? - -The Discounts pages in the Medusa Admin include many functionalities including: - -- Create a Discount -- Edit a Discount diff --git a/docs/content/user-guide/gift-cards/_category_.json b/docs/content/user-guide/gift-cards/_category_.json new file mode 100644 index 0000000000..8559a4889f --- /dev/null +++ b/docs/content/user-guide/gift-cards/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 7, + "collapsed": false, + "link": null, + "label": "Gift Cards" +} \ No newline at end of file diff --git a/docs/content/user-guide/gift-cards/custom.md b/docs/content/user-guide/gift-cards/custom.md new file mode 100644 index 0000000000..2681d72963 --- /dev/null +++ b/docs/content/user-guide/gift-cards/custom.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 3 +--- + +# Manage Custom Gift Cards + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/gift-cards/index.md b/docs/content/user-guide/gift-cards/index.md new file mode 100644 index 0000000000..58a047de8f --- /dev/null +++ b/docs/content/user-guide/gift-cards/index.md @@ -0,0 +1,18 @@ +--- +sidebar_position: 1 +--- + +# Gift Cards Overview + +In this document, you’ll learn about how Gift Cards in Medusa work. + +## Overview + +In Medusa, there’s one main gift card. A gift card can have multiple denominations. For example, a Gift Card can have the amounts of $20 and $50, and customers can buy one of these denominations. + +You can also create custom gift cards in Medusa. These cards can be created and sent directly to a customer’s email. + +## Learn More About Gift Cards + +- [Manage Gift Cards](./manage.mdx) +- [Manage Custom Gift Cards](./custom.md) diff --git a/docs/content/user-guide/gift-cards/index.mdx b/docs/content/user-guide/gift-cards/index.mdx deleted file mode 100644 index 4ed178b67f..0000000000 --- a/docs/content/user-guide/gift-cards/index.mdx +++ /dev/null @@ -1,240 +0,0 @@ -import UiIcon from '@site/src/components/UiIcon'; - -# Manage a Gift Card - -In this document, you’ll learn about how Gift Cards in Medusa work. This includes how to create, edit, and delete them. - -## Overview - -In Medusa, there’s one main gift card. A gift card can have multiple denominations. For example, a Gift Card can have the amounts of $20 and $50, and customers can buy one of these denominations. - -:::info - -Medusa also supports custom gift cards, which can be sent to a specific customer. - -::: - -## Create Gift Card - -:::info - -You can only create one gift card per store. - -::: - -Click on Gift Cards in the sidebar menu. If you don’t have any gift cards you should see a prompt to create your first gift card. Click on Create Gift Card. - -![Click on Create Gift Card in Gift Cards page](https://i.imgur.com/KjfMARd.png) - -In the new window that opens: - -- Enter a name for the gift card -- You can optionally enter a description and a thumbnail. -- Click on Add Denomination. You must at least add one denomination - - For each denomination, choose the currency and amount. - - If you want to delete a denomination, you can click the icon. -- Once you’re done, click Create & Publish. - -:::tip - -If you want to add more than one currency value for a denomination, you can do that when you [edit a denomination](#edit-a-denomination). - -::: - -![Example of fields in Create Gift Card window](https://i.imgur.com/xftW9bj.png) - -## Edit Gift Card - -To edit a Gift Card: - -- Go to the Gift Cards page from the sidebar menu. -- Next to the main gift card, click on the icon. -- Choose Edit from the dropdown. - -![Edit link is the first one in the dropdown](https://i.imgur.com/2PM0tBO.png) - -This opens a form to edit the gift card details and denominations. - -### Edit Gift Card Information - -You can edit the name, subtitle, and description of a Gift card. - -You can also click on “Show additional details”. Here, you can change the handle of the gift card, tags, and product type. - -After making the edits, click Save at the bottom right of the page. - -:::info - -The handle is the URL used on the storefront to view the Gift Card. - -::: - -![Example of Gift Card Information form](https://i.imgur.com/x2PMJum.png) - -### Add a Denomination - -On the Denominations section, click on Add Denomination at the top right of the section. - -![Click on Add Denomination at the top right of the section](https://i.imgur.com/bDlqOCS.png) - -In the window that opens: - -- Choose the currency of the denomination -- Enter the amount of the denomination -- Optionally, you can enter other values for the denominations. This is useful if you want to enter an amount in another currency. To do that: - - Click on “Add a price” under Other Values. - - Choose the currency and amount. - - To delete a price under Other Values, click on the icon. -- Once you’re done, click Save. - -![Example of Add Denomination form](https://i.imgur.com/5fAosFQ.png) - -### Edit a Denomination - -To edit a denomination: - -- In the Denominations section, find the denomination you want to edit. -- Click on the icon in the same row as the denomination you want to edit. -- Click on Edit Denomination from the dropdown. - -![Edit denomination is the first link in the dropdown](https://i.imgur.com/F4lBLkW.png) - -This opens a new window to edit the denomination. You can then: - -- Edit the currency or amount of existing prices of the denomination. -- Add prices for other currencies by clicking “Add a price” -- Delete prices by clicking the icon. - -Once you’re done, click Save. - -![Example of Edit Denomination form](https://i.imgur.com/qPNXCI6.png) - -### Delete a Denomination - -:::warning - -If you delete a denomination, customers won’t be able to find it in the storefront, purchase it, or use it. - -::: - -To delete a denomination: - -- In the Denominations section, find the denomination you want to edit. -- Click on the icon in the same row as the denomination you want to delete. -- Click on Delete Denomination from the dropdown. -- Confirm deleting the denomination by clicking the “Yes, delete” button in the pop-up. - -![Delete denomination link is the second link in the dropdown](https://i.imgur.com/OrgV3wb.png) - -### Add Images - -:::info - -You can add up to 10 images for a Gift Card. - -::: - -To add images to the Gift Card: - -- Go to the Images section. -- Either drag and drop your image to the dashed box or click on the box and choose the image you want to add. -- Click Save at the bottom right of the page. - -:::note - -If you face any errors or difficulties while uploading an image, please contact your technical support team as this could be an issue in the storage integration used. - -::: - -![The save button is at the bottom right of the page](https://i.imgur.com/lwyxPnz.png) - -### Change Thumbnail Image - -:::note - -You must have more than one image for a gift card to change the thumbnail image. - -::: - -To change the thumbnail image: - -- Go to the Images section. -- Check the radio button under the Thumbnail column for the image you want to make the thumbnail. -- Click Save at the bottom right of the page. - -![Check the radio button and click save at the bottom right](https://i.imgur.com/2Cz6s21.png) - -### Delete Gift Card Image - -:::warning - -If you delete an image, you won’t be able to restore it. - -::: - -To delete a gift card image: - -- Go to the Images section. -- Click on the icon at the right of the image you want to delete. -- Click Save at the bottom right of the page. - -## Unpublish Gift Card - -:::caution - -Unpublishing a gift card prevents customers from seeing the gift card in the storefront, purchasing it, or using it. - -::: - -### On Gift Cards Page - -- Click on the icon at the top right of the main gift card. -- Choose Unpublish. - -![Unpublish link is the second link in the dropdown](https://i.imgur.com/jF1vwyO.png) - -### On Edit Gift Card Page - -- Click on the icon at the top right of the Product Information section. -- Choose Unpublish Gift Card from the dropdown. - -![Unpublish Gift Card link is the first link in the dropdown](https://i.imgur.com/L09A4Pr.png) - -## Publish Gift Card - -:::note - -Publishing a gift card allows customers to see the gift card on the storefront, purchase it, and use it. - -::: - -### On Gift Cards Page - -- Click on the icon at the top right of the main gift card. -- Choose Publish. - -![Publish link is the second link in the dropdown](https://i.imgur.com/PfaDRqr.png) - -### On Edit Gift Card Page - -- Click on the icon at the top right of the Product Information section. -- Choose Publish Gift Card from the dropdown. - -![Publish Gift Card link is the first link in the dropdown](https://i.imgur.com/9AwA8wH.png) - -## Delete Gift Card - -:::warning - -If you delete a gift card, you can’t restore it or its settings. Customers also can’t use the gift card if they had previously purchased it. - -::: - -To delete a gift card: - -- Go to the Gift Cards page from the sidebar menu. -- Next to the main gift card, click on the icon. -- Choose Delete from the dropdown. -- Confirm deleting the gift card by clicking the “Yes, delete” button in the pop-up. - -![Delete link is the third link in the dropdown](https://i.imgur.com/Ue1zeUm.png) \ No newline at end of file diff --git a/docs/content/user-guide/gift-cards/manage.mdx b/docs/content/user-guide/gift-cards/manage.mdx new file mode 100644 index 0000000000..7bd5621f45 --- /dev/null +++ b/docs/content/user-guide/gift-cards/manage.mdx @@ -0,0 +1,209 @@ +--- +sidebar_position: 2 +--- + +import UiIcon from '@site/src/components/UiIcon'; + +# Manage a Gift Card + +In this document, you’ll learn about managing gift cards, including how to create, edit, and delete them. + +## Create Gift Card + +:::info + +You can only create one gift card per store. + +::: + +Click on Gift Cards in the sidebar menu. If you don’t have any gift cards you should see a prompt to create your first gift card. + +To create a Gift Card: + +1. Click on Create Gift Card. +2. In the new window that opens: + - Enter a name for the gift card + - You can optionally enter a description and a thumbnail. + - Click on Add Denomination. You must at least add one denomination + - For each denomination, choose the currency and amount. + - If you want to delete a denomination, you can click the icon. +3. Once you’re done, click Create & Publish. + +:::tip + +If you want to add more than one currency value for a denomination, you can do that when you [edit a denomination](#edit-a-denomination). + +::: + +--- + +## Edit Gift Card + +To edit a Gift Card: + +1. Go to the Gift Cards page from the sidebar menu. +2. Next to the main gift card, click on the icon. +3. Choose Edit from the dropdown. + +This opens a form to edit the gift card details and denominations. + +### Edit Gift Card Information + +You can edit the name, subtitle, and description of a Gift card. + +You can also click on “Show additional details”. Here, you can change the handle of the gift card, tags, and product type. + +After making the edits, click Save at the bottom right of the page. + +:::info + +The handle is the URL used on the storefront to view the Gift Card. + +::: + +### Add a Denomination + +On the Denominations section, click on Add Denomination at the top right of the section. + +In the window that opens: + +1. Choose the currency of the denomination +2. Enter the amount of the denomination +3. Optionally, you can enter other values for the denominations. This is useful if you want to enter an amount in another currency. To do that: + - Click on “Add a price” under Other Values. + - Choose the currency and amount. + - To delete a price under Other Values, click on the icon. +4. Once you’re done, click Save. + +### Edit a Denomination + +To edit a denomination: + +1. In the Denominations section, find the denomination you want to edit. +2. Click on the icon in the same row as the denomination you want to edit. +3. Click on Edit Denomination from the dropdown. +4. This opens a new window to edit the denomination. You can then: + - Edit the currency or amount of existing prices of the denomination. + - Add prices for other currencies by clicking “Add a price” + - Delete prices by clicking the icon. +5. Once you’re done, click Save. + +### Delete a Denomination + +:::warning + +If you delete a denomination, customers won’t be able to find it in the storefront, purchase it, or use it. + +::: + +To delete a denomination: + +1. In the Denominations section, find the denomination you want to edit. +2. Click on the icon in the same row as the denomination you want to delete. +3. Click on Delete Denomination from the dropdown. +4. Confirm deleting the denomination by clicking the “Yes, delete” button in the pop-up. + +### Add Images + +:::info + +You can add up to 10 images for a Gift Card. + +::: + +To add images to the Gift Card: + +1. Go to the Images section. +2. Either drag and drop your image to the dashed box or click on the box and choose the image you want to add. +3. Click Save at the bottom right of the page. + +:::note + +If you face any errors or difficulties while uploading an image, please contact your technical support team as this could be an issue in the storage integration used. + +::: + +### Change Thumbnail Image + +:::info + +You must have more than one image for a gift card to change the thumbnail image. + +::: + +To change the thumbnail image: + +1. Go to the Images section. +2. Check the radio button under the Thumbnail column for the image you want to make the thumbnail. +3. Click Save at the bottom right of the page. + +### Delete Gift Card Image + +:::caution + +If you delete an image, you won’t be able to restore it. + +::: + +To delete a gift card image: + +1. Go to the Images section. +2. Click on the icon at the right of the image you want to delete. +3. Click Save at the bottom right of the page. + +--- + +## Unpublish Gift Card + +:::caution + +Unpublishing a gift card prevents customers from seeing the gift card in the storefront, purchasing it, or using it. + +::: + +### On Gift Cards Page + +1. Click on the icon at the top right of the main gift card. +2. Choose Unpublish. + +### On Edit Gift Card Page + +1. Click on the icon at the top right of the Product Information section. +2. Choose Unpublish Gift Card from the dropdown. + +--- + +## Publish Gift Card + +:::note + +Publishing a gift card allows customers to see the gift card on the storefront, purchase it, and use it. + +::: + +### On Gift Cards Page + +1. Click on the icon at the top right of the main gift card. +2. Choose Publish. + +### On Edit Gift Card Page + +1. Click on the icon at the top right of the Product Information section. +2. Choose Publish Gift Card from the dropdown. + +--- + +## Delete Gift Card + +:::warning + +If you delete a gift card, you can’t restore it or its settings. Customers also can’t use the gift card if they had previously purchased it. + +::: + +To delete a gift card: + +1. Go to the Gift Cards page from the sidebar menu. +2. Click on the icon next to the main gift card. +3. Choose Delete from the dropdown. +4. Confirm deleting the gift card by clicking the “Yes, delete” button in the pop-up. \ No newline at end of file diff --git a/docs/content/user-guide/index.mdx b/docs/content/user-guide/index.mdx index c5cae79ded..ddc4264e3f 100644 --- a/docs/content/user-guide/index.mdx +++ b/docs/content/user-guide/index.mdx @@ -1,3 +1,8 @@ +--- +sidebar_position: 1 +sidebar_label: Introduction +--- + import UiIcon from '@site/src/components/UiIcon'; # Welcome to Medusa’s User Guide diff --git a/docs/content/user-guide/lists.mdx b/docs/content/user-guide/lists.mdx new file mode 100644 index 0000000000..d6f0c929a2 --- /dev/null +++ b/docs/content/user-guide/lists.mdx @@ -0,0 +1,89 @@ +--- +sidebar_position: 2 +--- + +import UiIcon from '@site/src/components/UiIcon'; + +# Lists Overview + +In this document, you’ll get an overview of lists in Medusa including filters, searching, and more! + +## Filter Items + +You can use filters to retrieve only items in a list matching specific criteria. + +### Quick Filters + +On a table with a list of items, you’ll find quick filters at the top of the list. + +You can click on one of these filters to quickly apply it to the list of items. + +![https://i.imgur.com/eVwD0JP.png](https://i.imgur.com/eVwD0JP.png) + +### Advanced Filters + +You can use advanced filters to furthermore limit the items shown based on specific criteria. For example, on the Orders list, you can filter orders to only show pending orders created in a specific region. + +To use advanced filters: + +1. Click on the icon next to Filters. This will toggle a dropdown with categories for different fields. +2. You can click on a field name to expand it and choose a filter for that field. +3. Click on the Apply button at the top of the dropdown. + +This will retrieve the items based on the filters you’ve selected. + +![https://i.imgur.com/rg9nKcS.png](https://i.imgur.com/rg9nKcS.png) + +### Save Advanced Filters as Quick Filters + +If there are filters that you need to use frequently, you can give the set of filters a name and save them to be used later. For example, you can save the filters used in the previous example as “European Orders”. + +To save an advanced filter: + +1. Click on the icon next to Filters. +2. Choose your filters from the dropdown. +3. Choose a name for the filters in the input at the end of the dropdown. +4. Click the Save button. + +![https://i.imgur.com/0nKZ5BX.png](https://i.imgur.com/0nKZ5BX.png) + +Once you click Save, you should see the new filter you added next to the Quick Filters at the top of the list. + +![https://i.imgur.com/ymuSHkv.png](https://i.imgur.com/ymuSHkv.png) + +To apply a saved quick filter, just click on it. + +### Delete Saved Quick Filters + +You can delete any saved filter you’ve created. To do that, simply click on the icon next to the quick filter’s name, and it will be deleted. + +### Clear Filters + +To clear all applied filters: + +1. Click on the icon next to Filters. +2. Click on the Clear button. + +![https://i.imgur.com/ArawLDT.png](https://i.imgur.com/ArawLDT.png) + +:::info + +Clearing filters does not delete saved quick filters. You can still apply them by clicking on them. + +::: + +--- + +## Search Items + +You can search for items in a list by clicking the icon at the top right of the list. + +![https://i.imgur.com/Z09rbmQ.png](https://i.imgur.com/Z09rbmQ.png) + +--- + +## Multiple Pages + +Lists in the Medusa admin can span across multiple pages if the number of items in that list are more than 15. + +In that case, you can navigate between pages by clicking the arrows at the bottom of the list. \ No newline at end of file diff --git a/docs/content/user-guide/orders/_category_.json b/docs/content/user-guide/orders/_category_.json new file mode 100644 index 0000000000..649f89442a --- /dev/null +++ b/docs/content/user-guide/orders/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 3, + "collapsed": false, + "link": null, + "label": "Orders" +} \ No newline at end of file diff --git a/docs/content/user-guide/orders/claims.md b/docs/content/user-guide/orders/claims.md new file mode 100644 index 0000000000..8c548c87f9 --- /dev/null +++ b/docs/content/user-guide/orders/claims.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 8 +--- + +# Manage Claims + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/orders/drafts.md b/docs/content/user-guide/orders/drafts.md new file mode 100644 index 0000000000..a81db79290 --- /dev/null +++ b/docs/content/user-guide/orders/drafts.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 5 +--- + +# Manage Draft Orders + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/orders/fulfillments.md b/docs/content/user-guide/orders/fulfillments.md new file mode 100644 index 0000000000..b383547471 --- /dev/null +++ b/docs/content/user-guide/orders/fulfillments.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 4 +--- + +# Manage Fulfillments + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/orders/index.md b/docs/content/user-guide/orders/index.md new file mode 100644 index 0000000000..8d956a5e65 --- /dev/null +++ b/docs/content/user-guide/orders/index.md @@ -0,0 +1,35 @@ +--- +sidebar_position: 1 +--- + +# Orders Overview + +In this document, you’ll get an overview of the orders listing page and everything you can do with it. + +## Overview + +When customers buy one or more products, their order appears on the Orders page. You can view an order’s information, capture payment, create shipments and fulfillments, register returns or exchanges of the order, and more. + +The Orders domain also contains draft orders. Draft orders are orders that you create from the Medusa admin. After you fill out the order and mark it paid, it’s transformed into an order that appears as part of the Orders list. + +## View List of Orders + +You can view the list of available orders in your ecommerce store by clicking on Orders from the sidebar menu. + +In the list, you can see order details such as the ID, date, customer, fulfillment and payment status, total, and the country of the shipping address. + +## View List of Draft Orders + +You can view the list of draft orders on the Orders page by clicking on the grey Drafts headline next to the Orders headline. + +In the list, you can see order details such as ID, the ID of the order the draft order belongs to, the date, the customer, and the status of the draft order. + +## Learn More About Orders + +- [Manage Order Details](./manage.md) +- [Manage Order’s Payment](./payments.md) +- [Manage Order’s Fulfillment](./fulfillments.md) +- [Manage Draft Orders](./drafts.md) +- [Manage Order Returns](./returns.md) +- [Manage Order Claims](./claims.md) +- [Manage Order Exchanges and Swaps](./swaps.md) diff --git a/docs/content/user-guide/orders/index.mdx b/docs/content/user-guide/orders/index.mdx deleted file mode 100644 index 8c93307e05..0000000000 --- a/docs/content/user-guide/orders/index.mdx +++ /dev/null @@ -1,121 +0,0 @@ -import UiIcon from '@site/src/components/UiIcon'; - -# Orders Overview - -In this document, you’ll get an overview of the orders listing page and all the things you can do with it. - -## View List of Orders - -You can view the list of available orders in your ecommerce store by clicking on Orders from the sidebar menu. - -![Orders List](https://i.imgur.com/dRBQpZW.png) - -In the list, you can see order details such as the ID, date, customer, fulfillment and payment status, total, and the country of the shipping address. - -:::tip - -If there are more than 15 orders, the list will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. - -::: - -## View List of Draft Orders - -You can view the list of draft orders on the Orders page by clicking on the grey Drafts headline next to the Orders headline. - -![Draft Orders List](https://i.imgur.com/jvNVbbI.png) - -In the list, you can see order details such as ID, the ID of the order the draft order belongs to, the date, the customer, and the status of the draft order. - -:::tip - -If there are more than 15 orders, the list will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. - -::: - -## Filter Orders - -You can use filters to retrieve only orders matching specific criteria. - -### Quick Filters - -On the Orders list page, you’ll find quick filters such as “Complete” and “Incomplete” at the top of the list. These filters show the complete and incomplete orders respectively. - -You can click on one of these filters to quickly filter the orders. - -![Activated quick filter](https://i.imgur.com/eVwD0JP.png) - -### Advanced Filters - -You can use advanced filters to furthermore limit the orders shown based on specific criteria. For example, you can filter orders to only show pending orders created in a specific region. - -To use advanced filters: - -- Click on the icon next to Filters. This will toggle a dropdown with categories for different fields. -- You can click on a field name to expand it and choose a filter for that field. -- Click on the Apply button at the top of the dropdown. - -This will retrieve the orders based on the filters you’ve selected. - -![Advanced filters dropdown with more than one filter selected](https://i.imgur.com/rg9nKcS.png) - -### Save Advanced Filters as Quick Filters - -If there are filters that you need to use frequently, you can give the set of filters a name and save them to be used later. For example, you can save the filters used in the previous example as “European Orders”. - -To save an advanced filter: - -- Click on the icon next to Filters. -- Choose your filters from the dropdown. -- Choose a name for the filters in the input at the end of the dropdown. -- Click the Save button. - -![Give the filters a name and click Save](https://i.imgur.com/0nKZ5BX.png) - -Once you click Save, you should see the new filter you added next to the Quick Filters at the top of the orders list. - -![Saved Filter shows as a quick filter](https://i.imgur.com/ymuSHkv.png) - -To apply a saved quick filter, just click on it. - -### Delete Saved Quick Filters - -You can delete any saved filter you’ve created. To do that, simply click on the icon next to the quick filter’s name, and it will be deleted. - -### Clear Filters - -To clear all applied filters: - -- Click on the + icon next to Filters. -- Click on the Clear button. - -![Click clear button in the advanced filters dropdown](https://i.imgur.com/ArawLDT.png) - -:::info - -Clearing filters does not delete saved quick filters. You can still apply them by clicking on them. - -::: - -## Search Orders - -You can search for orders by clicking the icon at the top right of the order list. When you search orders, you are searching by the first name supplied in the shipping address, the email associated with the order, and the order ID. - -![Search orders by customer name](https://i.imgur.com/Z09rbmQ.png) - -## Search Draft Orders - -You can search for draft orders by clicking the icon at the top right of the draft order list. When you search draft orders, you are searching by the email associated with the draft order and the draft order’s ID. - -![Search draft orders by email](https://i.imgur.com/el0Y9WS.png) - -## What More Can you Do with Orders? - -The Orders pages in the Medusa Admin include many functionalities including: - -- Manage and View Order’s Details -- Manage Order’s Payment -- Manage Order’s Fulfillment -- Create a Draft Order -- Manage Order Returns -- Manage Order Claims -- Manage Order Exchanges and Swaps \ No newline at end of file diff --git a/docs/content/user-guide/orders/manage.md b/docs/content/user-guide/orders/manage.md new file mode 100644 index 0000000000..213f7fa023 --- /dev/null +++ b/docs/content/user-guide/orders/manage.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 2 +--- + +# Manage Orders + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/orders/payments.md b/docs/content/user-guide/orders/payments.md new file mode 100644 index 0000000000..c225d91297 --- /dev/null +++ b/docs/content/user-guide/orders/payments.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 3 +--- + +# Manage Payments + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/orders/returns.md b/docs/content/user-guide/orders/returns.md new file mode 100644 index 0000000000..77b997dd52 --- /dev/null +++ b/docs/content/user-guide/orders/returns.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 6 +--- + +# Manage Returns + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/orders/swaps.md b/docs/content/user-guide/orders/swaps.md new file mode 100644 index 0000000000..9e63503ce5 --- /dev/null +++ b/docs/content/user-guide/orders/swaps.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 7 +--- + +# Manage Exchanges (Swaps) + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/price-lists/_category_.json b/docs/content/user-guide/price-lists/_category_.json new file mode 100644 index 0000000000..fb8f81ea75 --- /dev/null +++ b/docs/content/user-guide/price-lists/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 8, + "collapsed": false, + "link": null, + "label": "Price Lists" +} \ No newline at end of file diff --git a/docs/content/user-guide/price-lists/create.md b/docs/content/user-guide/price-lists/create.md new file mode 100644 index 0000000000..82f347858c --- /dev/null +++ b/docs/content/user-guide/price-lists/create.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 2 +--- + +# Create a Price List + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/price-lists/delete.md b/docs/content/user-guide/price-lists/delete.md new file mode 100644 index 0000000000..cd0519bc23 --- /dev/null +++ b/docs/content/user-guide/price-lists/delete.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 4 +--- + +# Delete a Price List + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/price-lists/edit.md b/docs/content/user-guide/price-lists/edit.md new file mode 100644 index 0000000000..b45784e3a6 --- /dev/null +++ b/docs/content/user-guide/price-lists/edit.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 3 +--- + +# Edit a Price List + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/price-lists/index.md b/docs/content/user-guide/price-lists/index.md new file mode 100644 index 0000000000..b627a43427 --- /dev/null +++ b/docs/content/user-guide/price-lists/index.md @@ -0,0 +1,31 @@ +--- +sidebar_position: 1 +--- + +# Price Lists Overview + +In this document, you learn about what price lists are and get an overview of the Pricing page. + +## Overview + +Price lists are used to add a sale or override the pricing of one or more products based on specific conditions. + +Adding a price list on a set of products would change the prices of these products to an amount you set. You can set the start and end dates of these prices. + +You can also specify customer groups to which these prices will be applied. For example, you may apply reduced pricing for VIP customers. + +--- + +## View List of Price Lists + +You can view the list of available price lists in your ecommerce store by clicking on Pricing from the sidebar menu. + +In the list, you can see price list details such as the name, description, and status of the price list. + +--- + +## Learn More About Price Lists + +- [Create a Price List](./create.md) +- [Edit a Price List](./edit.md) +- [Delete a Price List](./delete.md) diff --git a/docs/content/user-guide/price-lists/index.mdx b/docs/content/user-guide/price-lists/index.mdx deleted file mode 100644 index 16e01a26a8..0000000000 --- a/docs/content/user-guide/price-lists/index.mdx +++ /dev/null @@ -1,93 +0,0 @@ -import UiIcon from '@site/src/components/UiIcon'; - -# Price Lists Overview - -In this document, you learn about what price lists are and get an overview of the Pricing page. - -## Overview - -Price lists are used to add a sale or override the pricing of one or more products based on specific conditions. - -Adding a price list on a set of products would change the prices of these products to an amount you set. You can set the start and end dates of these prices. - -You can also specify customer groups that these prices will be applied to. For example, you may apply reduced pricing for VIP customers. - -## View List of Price Lists - -You can view the list of available price lists in your ecommerce store by clicking on Pricing from the sidebar menu. - -![List of Price Lists](https://i.imgur.com/go5QtbK.png) - -In the list, you can see price list details such as the name, description, and status of the price list. - -:::tip - -If there are more than 15 price lists, the list of price lists will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. - -::: - -## Filter Price Lists - -You can use filters to retrieve only price lists matching specific criteria. - -### Advanced Filters - -You can use advanced filters to limit the price lists shown based on specific criteria. For example, you can filter price lists to only show active price lists. - -To use advanced filters: - -- Click on the icon next to Filters. This will toggle a dropdown with categories for different fields. -- You can click on a field name to expand it and choose a filter for that field. -- Click on the Apply button at the top of the dropdown. - -This will retrieve the price lists based on the filters you’ve selected. - -![Advanced filters dropdown with more than one filter selected](https://i.imgur.com/z30iwiK.png) - -### Save Advanced Filters as Quick Filters - -If there are filters that you need to use frequently, you can give the set of filters a name and save them to be used later. For example, you can save the filters used in the previous example as “Active”. - -To save an advanced filter: - -- Click on the icon next to Filters. -- Choose your filters from the dropdown. -- Choose a name for the filters in the input at the end of the dropdown. -- Click the Save button. - -![Give the filters a name and click Save](https://i.imgur.com/eQIbZgS.png) - -Once you click Save, you should see the new filter you added next to the Quick Filters at the top of the list. - -![Saved Filter shows as a quick filter](https://i.imgur.com/54r2lf5.png) - -To apply a saved quick filter, just click on it. - -### Delete Saved Quick Filters - -You can delete any saved filter you’ve created. To do that, simply click on the icon next to the quick filter’s name, and it will be deleted. - -### Clear Filters - -To clear all applied filters: - -- Click on the icon next to Filters. -- Click on the Clear button. - -![Click clear button in the advanced filters dropdown](https://i.imgur.com/25yX8mq.png) - -:::info - -Clearing filters does not delete saved quick filters. You can still apply them by clicking on them. - -::: - -## Search Price Lists - -You can search for price lists by clicking the icon at the top right of the list. When you search for price lists, you search by price list name and description, and customer group names. - -![Search discounts by code](https://i.imgur.com/IqEWTkc.png) - -## What More Can you Do with Price Lists? - -The Pricing pages in the Medusa Admin include many functionalities including creating and managing price lists. \ No newline at end of file diff --git a/docs/content/user-guide/products/_category_.json b/docs/content/user-guide/products/_category_.json new file mode 100644 index 0000000000..06cf358dd1 --- /dev/null +++ b/docs/content/user-guide/products/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 4, + "collapsed": false, + "link": null, + "label": "Products" +} \ No newline at end of file diff --git a/docs/content/user-guide/products/collections.md b/docs/content/user-guide/products/collections.md new file mode 100644 index 0000000000..79bea495f8 --- /dev/null +++ b/docs/content/user-guide/products/collections.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 5 +--- + +# Manage Collections + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/products/export.mdx b/docs/content/user-guide/products/export.mdx new file mode 100644 index 0000000000..7ddd37f6d4 --- /dev/null +++ b/docs/content/user-guide/products/export.mdx @@ -0,0 +1,56 @@ +--- +sidebar_position: 4 +--- + +import UiIcon from '@site/src/components/UiIcon'; + +# Export Products + +In this document, you’ll learn how to export all products in your Medusa store. + +## Overview + +When you export your products, you can obtain a list of your products and their details in a CSV file. This can be useful if you want to migrate from one Medusa server to another, or if you need the CSV file for other purposes. + +--- + +## Export List of Products + +To export products: + +1. Go to the Products page. +2. Click on Export Products at the top right. +3. Click Export in the window that opens. +4. Click on the icon at the top right of the page. +5. You should see your new export loading. +6. Once the export is ready, click on the Download button. + +:::note + +If you face any errors or difficulties, please contact your technical support team as this could be an issue in the storage integration used. + +::: + +--- + +## Cancel a Product Export + +You can only cancel an unfinished product export. + +To cancel a product export: + +1. Click on the icon at the top right of the page. +2. Find the export you want to cancel. +3. Click on the cancel button. + +--- + +## Delete a Product Export + +You can only delete a finished product export. + +To delete a product export: + +1. Click on the icon at the top right of the page. +2. Find the export you want to delete. +3. Click on the Delete button. \ No newline at end of file diff --git a/docs/content/user-guide/products/index.mdx b/docs/content/user-guide/products/index.mdx index 52a6694c5f..a5f86e3c36 100644 --- a/docs/content/user-guide/products/index.mdx +++ b/docs/content/user-guide/products/index.mdx @@ -1,22 +1,30 @@ +--- +sidebar_position: 1 +--- + import UiIcon from '@site/src/components/UiIcon'; # Products Overview In this document, you’ll get an overview of the product listing page and all the things you can do with it. +## Overview + +Products are the goods you sell in your store. They can be physical or digital products. They can also be simple products or products with variants. + +You can create products and edit their details. That includes basic info, sales channels, inventory management, prices management, and much more. + +Part of the products domain is Collections. Collections are used to split products based on their type or function. For example, if you sell furniture and clothing, you can have two collections: Furniture and Clothing. + +--- + ## View List of Products You can view the list of available products in your ecommerce store by clicking on Products from the sidebar menu. -![Products List](https://i.imgur.com/xvRZQwK.png) - In the list, you can see product details such as the name, collection, inventory, and status of the product. -:::tip - -If there are more than 15 products, the list will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. - -::: +--- ## Change Product View @@ -28,146 +36,19 @@ To view products in a list view, which is the default view, click on the icon at the top right of the product list. -![Grid View of Products List](https://i.imgur.com/GkTcjsO.png) +--- ## View List of Collections -Collections are used to split products based on their type or function. For example, if you sell furniture and clothing, you can have two collections: Furniture and Clothing. - You can view the list of collections on the Products page by clicking on the grey Collections headline next to the Products headline. -![Collections List](https://i.imgur.com/RMRIGAW.png) - In the list, you can see collection details such as the title, handle, and the number of products in the collection. -:::tip +--- -If there are more than 15 collections, the list will be split into multiple pages. You can navigate between pages by clicking the arrows at the bottom of the list. +## Learn More About Products -::: - -## Filter Products - -You can use filters to retrieve only products matching specific criteria. - -### Quick Filters - -On the Products list page, you can find quick filters such as “Unpublished” at the top of the list. The “Unpublished” filter shows only draft products in the list. - -You can click on these filters to quickly filter the products. - -![Activated quick filter](https://i.imgur.com/KfZjvJg.png) - -### Advanced Filters - -You can use advanced filters to furthermore limit the products shown based on specific criteria. For example, you can filter products to only show draft products created in a specific collection. - -To use advanced filters: - -- Click on the icon next to Filters. This will toggle a dropdown with categories for different fields. -- You can click on a field name to expand it and choose a filter for that field. -- Click on the Apply button at the top of the dropdown. - -This will retrieve the products based on the filters you’ve selected. - -![Advanced filters dropdown with more than one filter selected](https://i.imgur.com/NMM2zBK.png) - -### Save Advanced Filters as Quick Filters - -If there are filters that you need to use frequently, you can give the set of filters a name and save them to be used later. For example, you can save the filters used in the previous example as “Draft Clothing”. - -To save an advanced filter: - -- Click on the icon next to Filters. -- Choose your filters from the dropdown. -- Choose a name for the filters in the input at the end of the dropdown. -- Click the Save button. - -![Give the filters a name and click Save](https://i.imgur.com/pV8TJM0.png) - -Once you click Save, you should see the new filter you added next to the Quick Filters at the top of the products list. - -![Saved Filter shows as a quick filter](https://i.imgur.com/s5WysMv.png) - -To apply a saved quick filter, just click on it. - -### Delete Saved Quick Filters - -You can delete any saved filter you’ve created. To do that, simply click on the icon next to the quick filter’s name, and it will be deleted. - -### Clear Filters - -To clear all applied filters: - -- Click on the icon next to Filters. -- Click on the Clear button. - -![Click clear button in the advanced filters dropdown](https://i.imgur.com/DiMdyrM.png) - -:::info - -Clearing filters does not delete saved quick filters. You can still apply them by clicking on them. - -::: - -## Search Products - -You can search for products by clicking the icon at the top right of the products list. When you search products, you search by product title, description, variant title, variant SKU, and collection title. - -![Search products by name](https://i.imgur.com/ch6dLZA.png) - -## Search Collections - -You can search for collections by clicking the icon at the top right of the collections list. When you search collections, you search by collection title and handle. - -![Search collections by title](https://i.imgur.com/KMJDIDJ.png) - -## Export Products - -To export products: - -- Go to the Products page. -- Click on Export Products at the top right. -- Click Export in the window that opens. -- Click on the icon at the top right of the page. -- You should see your new export loading. -- Once the export is ready, click on the Download button. - -:::note - -If you face any errors or difficulties, please contact your technical support team as this could be an issue in the storage integration used. - -::: - -![Click on the download button in the activity panel](https://i.imgur.com/VE7PBtW.png) - -### Cancel a Product Export - -You can only cancel an unfinished product export. - -To cancel a product export: - -- Click on the icon at the top right of the page. -- Find the export you want to cancel. -- Click on the cancel button. - -![Click on the cancel button in the activity panel](https://i.imgur.com/yEU4lUD.png) - -### Delete a Product Export - -You can only delete a finished product export. - -To delete a product export: - -- Click on the icon at the top right of the page. -- Find the export you want to delete. -- Click on the Delete button. - -![Click on the delete button in the activity panel](https://i.imgur.com/04Dat1k.png) - -## What More Can you Do with Products? - -The Products pages in the Medusa Admin include many functionalities including: - -- Manage and View Product Details. -- Manage and View Collection Details. \ No newline at end of file +- [Manage Products](./manage.md) +- [Manage Digital Products](./manage-digital.md) +- [Manage Collections](./collections.md) +- [Export Products](./export.mdx) \ No newline at end of file diff --git a/docs/content/user-guide/products/manage-digital.md b/docs/content/user-guide/products/manage-digital.md new file mode 100644 index 0000000000..6315575415 --- /dev/null +++ b/docs/content/user-guide/products/manage-digital.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 3 +--- + +# Manage Digital Products + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/products/manage.md b/docs/content/user-guide/products/manage.md new file mode 100644 index 0000000000..0e52872273 --- /dev/null +++ b/docs/content/user-guide/products/manage.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 2 +--- + +# Manage Products + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/regions/_category_.json b/docs/content/user-guide/regions/_category_.json new file mode 100644 index 0000000000..acb2ff8bd5 --- /dev/null +++ b/docs/content/user-guide/regions/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 9, + "collapsed": false, + "link": null, + "label": "Regions" +} \ No newline at end of file diff --git a/docs/content/user-guide/regions/index.md b/docs/content/user-guide/regions/index.md index 838595da2c..8e8fbc6815 100644 --- a/docs/content/user-guide/regions/index.md +++ b/docs/content/user-guide/regions/index.md @@ -1,6 +1,10 @@ +--- +sidebar_position: 1 +--- + # Regions Overview -In this document, you’ll get an overview of regions and learn about their importance in your ecommerce store +In this document, you’ll get an overview of regions and learn about their importance in your ecommerce store. ## Overview @@ -8,18 +12,24 @@ Regions are essential to your ecommerce store. They allow you to specify availab Regions represent different countries that your ecommerce store serves customers in. You can combine more than one country in the same region and give them the same settings, or you can create a different region for each country and add settings specific to each of them. -### Currencies in Regions +--- + +## Currencies in Regions Each region uses one currency. Having more than one region with each having different currencies allows you to set prices and amounts throughout your ecommerce store for each currency. For example, you can specify prices for a product for each currency you support. -![An example of prices for different currencies](https://i.imgur.com/XkLZajl.png) +--- -### How Customers Use Regions +## How Customers Use Regions When a customer browses your storefront, they can choose the region based on their location. Then, different pricing, shipping providers, payment providers, and taxes will be available and applied based on the chosen region. For example, if you have Stripe enabled as a payment provider in a region created for the United States, but have it disabled in a region created for European countries, only customers in the United States region can use Stripe for payment on checkout. -## What More Can you Do with Regions? +--- -In the Medusa admin, you can create and manage regions and their settings, such as available shipping options. You can learn more in [this guide](./manage.mdx). +## Learn More About Regions + +- [Manage Regions](./manage.mdx) +- [Manage Payment and Fulfillment Providers](./providers.md) +- [Manage Shipping Options in a Region](./shipping-options.md) diff --git a/docs/content/user-guide/regions/manage.mdx b/docs/content/user-guide/regions/manage.mdx index 2035625d14..6db46db888 100644 --- a/docs/content/user-guide/regions/manage.mdx +++ b/docs/content/user-guide/regions/manage.mdx @@ -1,3 +1,7 @@ +--- +sidebar_position: 2 +--- + import UiIcon from '@site/src/components/UiIcon'; # Manage Regions @@ -8,23 +12,23 @@ In this document, you’ll learn how to view and manage regions in your Medusa A To view your regions: -- Click on Settings in the sidebar. -- Choose Regions from the list of settings. +1. Click on Settings in the sidebar. +2. Choose Regions from the list of settings. This opens the Regions page where you can find a list of regions. -![List of Regions](https://i.imgur.com/qZgU1SC.png) +--- ## Create a Region To create a region: -- Go to Settings → Regions. -- Click on Add Region at the top right of the Regions section. -- In the window that opens you must enter the Regions details: +1. Go to Settings → Regions. +2. Click on Add Region at the top right of the Regions section. +3. In the window that opens you must enter the Regions details: - It is required to enter a name and choose a currency and at least one country, payment provider, and fulfillment provider. - - You can optionally enter a tax rate and code for the region. Alternatively, you can [edit a region’s tax settings and rates](../taxes/manage.mdx#edit-a-regions-taxes) after creation. -- Once you’re done, click Save. + - You can optionally enter a tax rate and code for the region. Alternatively, you can [edit a region’s tax settings and rates](../taxes/manage.md#edit-a-regions-taxes) after creation. +4. Once you’re done, click Save. :::tip @@ -32,148 +36,9 @@ If you can’t find the currency you want to use in the Currency field, make sur ::: -![Example form to add a region](https://i.imgur.com/Q3SBQW3.png) - After you click save, the region will be created and you can see it in the list on the left. -### Edit a Region - -To edit a region: - -- Go to Settings → Regions. -- Click on the region you want to edit from the Regions section. - -This opens a Details form to the right. You can edit basic information such as the name or currency. - -![Details form to edit a region](https://i.imgur.com/rJv9nUa.png) - -### Manage Payment Providers in a Region - -To add or remove a payment provider in a region: - -- Select a region to edit. -- Scroll down to the Payment Providers section in the Details form. -- Select the payment providers you want to add to the region. -- Unselect the payment providers you want to remove from the region. -- Click Save. - -![Example of choosing a payment provider](https://i.imgur.com/piD7oQi.png) - -### Manage Fulfillment Providers in a Region - -To add or remove a fulfillment provider in a region: - -- Select a region to edit. -- Scroll down to the Fulfillment Providers section in the Details form. -- Select the fulfillment providers you want to add to the region. -- Unselect the fulfillment providers you want to remove from the region. -- Click Save. - -![Examples of choosing a fulfillment provider](https://i.imgur.com/QzPAYU7.png) - -## Manage Shipping Options in a Region - -A shipping option is used by customers during checkout when they pick a shipping method for their order. They’re also used by admins when they create a draft order. - -### Add Shipping Option to a Region - -To add a shipping option: - -- Select a region to edit. -- Scroll down to the Shipping Options section in the Details form. -- Click on Add Option. -- A new window will open with a form with the following fields: - - **Name (Required):** The name of the shipping option. The customer will see this name on the storefront if the “Show on Website” field is checked. - - **Currency:** This is a read-only field and its value depends on the currency of the region. - - **Price (Required):** The price of the shipping option. - - **Show on Website:** Whether or not this option should be available on the website. This is useful if you want to create a shipping option only for use on the Medusa Admin (for example, to create draft orders). - - **Shipping Profile (Required):** The shipping profile this option belongs to. - - **Fulfillment Method (Required):** the fulfillment provider that will handle fulfilling this shipping option. - - **Requirements:** You can use this to specify a condition for when this shipping option should be available. The first field indicates the minimum cart subtotal, and the second field indicates the maximum cart subtotal. For example, you can fill in the first field “100” to only allow using this shipping option if the cart’s subtotal is at least $100. -- Once you’re done, click Save. - -![Form example of adding a shipping option](https://i.imgur.com/maiCo8D.png) - -### Edit a Shipping Option - -To edit a shipping option: - -- Select a region to edit. -- Scroll down to the Shipping Options section in the Details form. -- Find the shipping option you want to edit and click on Edit at the right of its name. -- A new window will open with the fields that you can edit. You can edit all of the fields you chose while adding the shipping option except for the Shipping Profile and Fulfillment Method. -- Once done, click Save. - -![Form example of editing a shipping option](https://i.imgur.com/mnsVOJF.png) - -### Delete a Shipping Option - -:::caution - -If you delete a shipping option, you can’t restore it or its data, customers can’t use it during checkout, and admins can’t use it for draft orders. - -::: - -To delete a shipping option: - -- Select a region to edit. -- Scroll down to the Shipping Options section in the Details form. -- Find the shipping option you want to edit and click on Edit at the right of its name. -- A new window will open. Click on Delete under the Danger Zone section. -- Confirm deleting the shipping option by clicking the “Yes, remove” button in the pop-up. - -![Delete shipping option link is under the Danger Zone section of the edit form](https://i.imgur.com/zGl3qt3.png) - -## Manage Return Shipping Options in a Region - -A return shipping option is a shipping option that is only used to return items in an order. It can be used by the customer when they request a return or an exchange, and by the admin when they request a return, register an exchange, or register a claim. - -### Add Return Shipping Option to a Region - -To add a return shipping option: - -- Select a region to edit. -- Scroll down to the Return Shipping Options section in the Details form. -- Click on Add Return. -- A new window will open with a form with the following fields: - - **Name (Required):** The name of the return shipping option. The customer will see this name on the storefront if the “Show on Website” field is checked. - - **Currency:** This is a read-only field and its value depends on the currency of the region. - - **Price (Required):** The price of the return shipping option. - - **Show on Website:** Whether or not this option should be available on the website. This is useful if you want to create a return shipping option only for use on the Medusa Admin (for example, to create claims or return requests from the Medusa Admin). - - **Fulfillment Method (Required):** the fulfillment provider that will handle fulfilling this return shipping option. -- Once you’re done, click Save. - -![Example form of adding a return shipping option](https://i.imgur.com/VXC67zT.png) - -### Edit a Return Shipping Option - -To edit a return shipping option: - -- Select a region to edit. -- Scroll down to the Return Shipping Options section in the Details form. -- Find the return shipping option you want to edit and click on Edit at the right of its name. -- A new window will open with the fields that you can edit. You can edit all of the fields you chose while adding the shipping profile except for the Fulfillment Method. -- Once done, click Save. - -![Example for of editing a return shipping option](https://i.imgur.com/go8UX6k.png) - -### Delete a Return Shipping Option - -:::caution - -If you delete a return shipping option, you can’t restore it or its data, customers can’t use it when they request a return or an exchange, and admins can’t use it when requesting a return for an order or registering an exchange or claim for an order. - -::: - -To delete a return shipping option: - -- Select a region to edit. -- Scroll down to the Return Shipping Options section in the Details form. -- Find the return shipping option you want to edit and click on Edit at the right of its name. -- A new window will open. Click on Delete under the Danger Zone section. -- Confirm deleting the return shipping option by clicking the “Yes, remove” button in the pop-up. - -![Delete return shipping option link is under the Danger Zone section](https://i.imgur.com/wjjoFrT.png) +--- ## Duplicate a Region @@ -181,12 +46,10 @@ Duplicating a region allows you to create a new region with some of its details To duplicate a region: -- Go to Settings → Regions. -- Click on the region you want to duplicate from the Regions section. -- In the Details section, click on the icon. -- Choose Duplicate Region from the dropdown list. - -![Duplicate Region is the first link in the dropdown](https://i.imgur.com/qyzmMLF.png) +1. Go to Settings → Regions. +2. Click on the region you want to duplicate from the Regions section. +3. In the Details section, click on the icon. +4. Choose Duplicate Region from the dropdown list. ## Delete a Region @@ -198,10 +61,8 @@ If you delete a region, you will not be able to restore it or its data. Data rel To delete a region: -- Go to Settings → Regions. -- Click on the region you want to duplicate from the Regions section. -- In the Details section, click on the icon. -- Choose Delete Region from the dropdown list. -- Confirm deleting the region by clicking the “Yes, delete” button in the pop-up. - -![Delete Region is the second link in the dropdown](https://i.imgur.com/haVXAYO.png) \ No newline at end of file +1. Go to Settings → Regions. +2. Click on the region you want to duplicate from the Regions section. +3. In the Details section, click on the icon. +4. Choose Delete Region from the dropdown list. +5. Confirm deleting the region by clicking the “Yes, delete” button in the pop-up. \ No newline at end of file diff --git a/docs/content/user-guide/regions/providers.md b/docs/content/user-guide/regions/providers.md new file mode 100644 index 0000000000..1d3805bd08 --- /dev/null +++ b/docs/content/user-guide/regions/providers.md @@ -0,0 +1,39 @@ +--- +sidebar_position: 3 +--- + +# Manage Payment and Fulfillment Providers + +In this document, you’ll learn how to manage a region’s payment and fulfillment providers in your Medusa Admin. + +## Overview + +You can choose the payment and fulfillment providers available in each region. This allows you to provide customers in specific regions the providers that are available in their country or region. + +When a payment or fulfillment provider is added to a region, it means a customer is able to select that payment or fulfillment provider during checkout to complete their purchase. + +--- + +## Manage Payment Providers + +To add or remove a payment provider in a region: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Payment Providers section in the Details form. +4. Select the payment providers you want to add to the region. +5. Unselect the payment providers you want to remove from the region. +6. Click Save. + +--- + +## Manage Fulfillment Providers + +To add or remove a fulfillment provider in a region: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Fulfillment Providers section in the Details form. +4. Select the fulfillment providers you want to add to the region. +5. Unselect the fulfillment providers you want to remove from the region. +6. Click Save. diff --git a/docs/content/user-guide/regions/shipping-options.md b/docs/content/user-guide/regions/shipping-options.md new file mode 100644 index 0000000000..5caff21a73 --- /dev/null +++ b/docs/content/user-guide/regions/shipping-options.md @@ -0,0 +1,112 @@ +--- +sidebar_position: 4 +--- + +# Manage Shipping Options + +In this document, you’ll learn how to manage a region’s shipping options in your Medusa Admin. + +## Types of Shipping Options + +There are two types of shipping options in a region: + +1. Shipping Options are used when a customer places an order or when an admin creates a draft order. +2. Return Shipping Options are used when a customer requests a return or swap for their order, or when an admin registers an exchange, a claim, or a return for an order. + +A shipping option can’t be used for both cases. In a region, you can create an unlimited amount of shipping options and return shipping options. + +## Manage Shipping Options in a Region + +### Add Shipping Option to a Region + +To add a shipping option: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Shipping Options section in the Details form. +4. Click on Add Option. +5. A new window will open with a form with the following fields: + - **Name (Required):** The name of the shipping option. The customer will see this name on the storefront if the “Show on Website” field is checked. + - **Currency:** This is a read-only field and its value depends on the currency of the region. + - **Price (Required):** The price of the shipping option. + - **Show on Website:** Whether or not this option should be available on the website. This is useful if you want to create a shipping option only for use on the Medusa Admin (for example, to create draft orders). + - **Shipping Profile (Required):** The shipping profile this option belongs to. + - **Fulfillment Method (Required):** the fulfillment provider that will handle fulfilling this shipping option. + - **Requirements:** You can use this to specify a condition for when this shipping option should be available. The first field indicates the minimum cart subtotal, and the second field indicates the maximum cart subtotal. For example, you can fill in the first field “100” to only allow using this shipping option if the cart’s subtotal is at least $100. +6. Once you’re done, click Save. + +### Edit a Shipping Option + +To edit a shipping option: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Shipping Options section in the Details form. +4. Find the shipping option you want to edit and click on Edit at the right of its name. +5. A new window will open with the fields that you can edit. You can edit all of the fields you chose while adding the shipping option except for the Shipping Profile and Fulfillment Method. +6. Once done, click Save. + +### Delete a Shipping Option + +:::warning + +If you delete a shipping option, you can’t restore it or its data, customers can’t use it during checkout, and admins can’t use it for draft orders. + +::: + +To delete a shipping option: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Shipping Options section in the Details form. +4. Find the shipping option you want to edit and click on Edit at the right of its name. +5. A new window will open. Click on Delete under the Danger Zone section. +6. Confirm deleting the shipping option by clicking the “Yes, remove” button in the pop-up. + +--- + +## Manage Return Shipping Options in a Region + +### Add Return Shipping Option to a Region + +To add a return shipping option: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Return Shipping Options section in the Details form. +4. Click on Add Return. +5. A new window will open with a form with the following fields: + - **Name (Required):** The name of the return shipping option. The customer will see this name on the storefront if the “Show on Website” field is checked. + - **Currency:** This is a read-only field and its value depends on the currency of the region. + - **Price (Required):** The price of the return shipping option. + - **Show on Website:** Whether or not this option should be available on the website. This is useful if you want to create a return shipping option only for use on the Medusa Admin (for example, to create claims or return requests from the Medusa Admin). + - **Fulfillment Method (Required):** the fulfillment provider that will handle fulfilling this return shipping option. +6. Once you’re done, click Save. + +### Edit a Return Shipping Option + +To edit a return shipping option: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Return Shipping Options section in the Details form. +4. Find the return shipping option you want to edit and click on Edit at the right of its name. +5. A new window will open with the fields that you can edit. You can edit all of the fields you chose while adding the shipping profile except for the Fulfillment Method. +6. Once done, click Save. + +### Delete a Return Shipping Option + +:::warning + +If you delete a return shipping option, you can’t restore it or its data, customers can’t use it when they request a return or an exchange, and admins can’t use it when requesting a return for an order or registering an exchange or claim for an order. + +::: + +To delete a return shipping option: + +1. Go to Settings → Regions. +2. Select a region to edit. +3. Scroll down to the Return Shipping Options section in the Details form. +4. Find the return shipping option you want to edit and click on Edit at the right of its name. +5. A new window will open. Click on Delete under the Danger Zone section. +6. Confirm deleting the return shipping option by clicking the “Yes, remove” button in the pop-up. \ No newline at end of file diff --git a/docs/content/user-guide/sales-channels/_category_.json b/docs/content/user-guide/sales-channels/_category_.json new file mode 100644 index 0000000000..ce29ed0e5f --- /dev/null +++ b/docs/content/user-guide/sales-channels/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 11, + "collapsed": false, + "link": null, + "label": "Sales Channels" +} \ No newline at end of file diff --git a/docs/content/user-guide/sales-channels/index.md b/docs/content/user-guide/sales-channels/index.md index 3cb7304213..90acbe4053 100644 --- a/docs/content/user-guide/sales-channels/index.md +++ b/docs/content/user-guide/sales-channels/index.md @@ -1,3 +1,7 @@ +--- +sidebar_position: 1 +--- + # Sales Channels Overview In this document, you’ll get an overview of sales channels in Medusa and learn about their importance in your ecommerce store. @@ -14,6 +18,8 @@ Sales Channels are multiple channels that you can sell your products through. Fo By default, there’s a default sales channel in a Medusa store. You can add multiple sales channels. +--- + ## How Sales Channels Work Sales channels are associated with data and settings in your ecommerce store. @@ -22,13 +28,15 @@ For each sales channel, you can choose which products belong to that sales chann Then, when customers place an order from a sales channel, the order is associated with that sales channel. You’ll be able to see the sales channel an order was placed from in the Medusa admin. +--- + ## Sales Channels Settings Overview To view the available sales channels and settings, go to Settings → Sales channels. In the sales channels settings page, You can view available sales channels, add more sales channels, edit sales channels, and manage products available in the sales channel. -![Overview of Sales Channels Page](https://i.imgur.com/9433HAR.png) +--- ## View Sales Channels of Orders @@ -36,13 +44,11 @@ In the sales channels settings page, You can view available sales channels, add In the Orders page, you can see the sales channel an order belongs to. If the order doesn’t belong to any sales channel, you can see “N/A” instead. -![Sales Channel column in Orders page](https://i.imgur.com/0tmYOn0.png) - ### Orders Details Page In the details page of an order, you can find the sales channel the order belongs to, if there are any. -![Sales Channel name in the Orders Details page](https://i.imgur.com/hqyYy0E.png) +--- ## View Sales Channels of Products @@ -50,14 +56,13 @@ In the details page of an order, you can find the sales channel the order belong In the Products page, you can see the sales channels a product belongs to under the Availability column if there are any. -![Sales Channel of a product can be shown under the Availability column on the Products page](https://i.imgur.com/SjaM1aq.png) - ### Products Edit Page In the edit page of a product, you can find the sales channels the product belongs to and edit them under the Sales Channels section. -![Sales Channels a product belongs to can be seen on the Edit Product page](https://i.imgur.com/m9n9viV.png) +--- -## What More Can you Do with Sales Channels? +## Learn More About Sales Channels -In the Medusa admin, you can manage the details of sales channels, their products, and more. You can learn more in [this guide](./manage.mdx). +- [Manage Sales Channels](./manage.mdx) +- [Manage Products in Sales Channels](./products.mdx) diff --git a/docs/content/user-guide/sales-channels/manage.mdx b/docs/content/user-guide/sales-channels/manage.mdx index 0579e075c6..16e0f25d90 100644 --- a/docs/content/user-guide/sales-channels/manage.mdx +++ b/docs/content/user-guide/sales-channels/manage.mdx @@ -1,3 +1,7 @@ +--- +sidebar_position: 2 +--- + import UiIcon from '@site/src/components/UiIcon'; # Manage Sales Channels @@ -8,38 +12,37 @@ In this document, you’ll learn how to view and manage sales channels in your M To view sales channels: -- Click on Settings in the sidebar. -- Choose Sales Channels from the list of settings. +1. Click on Settings in the sidebar. +2. Choose Sales Channels from the list of settings. This opens the Sales Channels page where you can see the list of Sales channels on the left and the products in the selected sales channel on the right. -For the products list, you can use the [same filters that are available in the Products page](../products/index.mdx#filter-products). - -![List of Sales Channels](https://i.imgur.com/0KnsuOc.png) +--- ## Search Sales Channels To search sales channels: -- Go to Settings → Sales Channels -- In the Sales Channels section on the left, click on the icon next to the title of the section. -- This shows an input to search sales channels by title and description. -- To clear the search, click on the icon in the search input. +1. Go to Settings → Sales Channels +2. In the Sales Channels section on the left, click on the icon next to the title of the section. +3. This shows an input to search sales channels by title and description. -![Search sales channels by name](https://i.imgur.com/sgSQ1Jy.png) +To clear the search, click on the icon in the search input. + +--- ## Create a Sales Channel To add a new sales channel: -- Go to Settings → Sales Channels -- In the Sales Channels section on the left, click on the icon next to the title of the section. -- The form to create a new sales channel will open. The name of the sales channel is required, but the description is optional. -- Once you’re done, you can either: +1. Go to Settings → Sales Channels +2. In the Sales Channels section on the left, click on the icon next to the title of the section. +3. The form to create a new sales channel will open. The name of the sales channel is required, but the description is optional. +4. Once you’re done, you can either: - Click Save as draft to save the sales channel as disabled. - Click Publish channel to save the sales channel as enabled. -![Form to create a sales channel](https://i.imgur.com/abOn4Sp.png) +--- ## Change the Status of a Sales Channel @@ -47,26 +50,26 @@ A sales channel can be enabled or disabled. If a sales channel is disabled, that To enable or disable a sales channel: -- Go to Settings → Sales Channels -- In the sales channels list on the left, choose the sales channel you want to enable/disable. -- At the top right of the right section, you can find the status of the sales channel, with a icon if it’s enabled or a icon if it’s disabled. -- Click on the status, and a dropdown will show to toggle the status. For example, if the status of the sales channel is Enabled, the dropdown will show a Disabled status. -- Choose the status in the dropdown, and the status of the sales channel will change. +1. Go to Settings → Sales Channels +2. In the sales channels list on the left, choose the sales channel you want to enable/disable. +3. At the top right of the right section, you can find the status of the sales channel, with a icon if it’s enabled or a icon if it’s disabled. +4. Click on the status, and a dropdown will show to toggle the status. For example, if the status of the sales channel is Enabled, the dropdown will show a Disabled status. +5. Choose the status in the dropdown, and the status of the sales channel will change. -![Toggle the status by choosing the opposite status in the dropdown](https://i.imgur.com/gtUs9sr.png) +--- ## Edit Sales Channel’s Information To edit a sales channel’s information: -- Go to Settings → Sales Channels -- In the sales channels list on the left, choose the sales channel you want to edit. -- At the top right of the right section, click on the icon. -- Choose from the dropdown list “Edit general info”. -- This opens a form in a window where you can edit the name and description of the sales channel. -- Once done, click Save. +1. Go to Settings → Sales Channels +2. In the sales channels list on the left, choose the sales channel you want to edit. +3. At the top right of the right section, click on the icon. +4. Choose from the dropdown list “Edit general info”. +5. This opens a form in a window where you can edit the name and description of the sales channel. +6. Once done, click Save. -![Form to edit a sales channel](https://i.imgur.com/1qicPDo.png) +--- ## Delete a Sales Channel @@ -78,63 +81,8 @@ If you delete a sales channel, you won’t be able to restore it. Orders and Pro To delete a sales channel: -- Go to Settings → Sales Channels -- In the sales channels list on the left, choose the sales channel you want to delete. -- At the top right of the right section, click on the icon. -- Choose from the dropdown list “Delete channel”. -- Confirm deleting the tax rate by clicking the “Yes, delete” button in the pop-up. - -![Delete channel is the third link in the dropdown](https://i.imgur.com/OmMygcf.png) - -## Manage Products in Sales Channels - -### Add Products to Sales Channels - -:::info - -You can also add a product to a Sales Channel from the product’s edit page. - -::: - -To add products to a sales channel: - -- Go to Settings → Sales Channels -- In the sales channels list on the left, choose the sales channel you want to add products to. -- At the top right of the right section, click on the icon. -- Choose from the dropdown list “Add products”. -- This opens a window to add products with [filters](../products/index.mdx#filter-products) and [search](../products/index.mdx#search-products) functionalities similar to those of a product page. -- Select the products you want to add to the sales channel. -- Click Save. - -:::info - -Products in the list that are grayed out are products that are already added to the sales channel. - -::: - -![Choose products to add to the sales channel](https://i.imgur.com/ubqdIsn.png) - -### Remove Product from Sales Channel - -:::note - -If you remove a product from a sales channel, it will still be available in your ecommerce store, just not in that sales channel. You can also add the product again to the sales channel. - -::: - -To remove a product from a sales channel: - -- Go to Settings → Sales Channels -- In the sales channels list on the left, choose the sales channel you want to remove the product from. -- Find the product you want to remove from the sales channel. -- Click the icon at the right side of the product’s row. -- Choose from the dropdown list “Remove from the channel”. - -:::info - -You can also remove a product from a Sales Channel from the product’s edit page. - -::: - - -![Remove from this channel link is the third link in the dropdown](https://i.imgur.com/3hZUBcx.png) \ No newline at end of file +1. Go to Settings → Sales Channels +2. In the sales channels list on the left, choose the sales channel you want to delete. +3. At the top right of the right section, click on the icon. +4. Choose from the dropdown list “Delete channel”. +5. Confirm deleting the tax rate by clicking the “Yes, delete” button in the pop-up. diff --git a/docs/content/user-guide/sales-channels/products.mdx b/docs/content/user-guide/sales-channels/products.mdx new file mode 100644 index 0000000000..aa6cc3054d --- /dev/null +++ b/docs/content/user-guide/sales-channels/products.mdx @@ -0,0 +1,50 @@ +--- +sidebar_position: 3 +--- + +import UiIcon from '@site/src/components/UiIcon'; + +# Manage Products in Sales Channels + +In this document, you’ll learn how to manage products in Sales Channels. + +:::note + +This guide covers managing products from the Sales Channels page. It’s also possible to manage the Sales Channels of products in the Products page. + +::: + +## Add Products to Sales Channels + +To add products to a sales channel: + +1. Go to Settings → Sales Channels +2. In the sales channels list on the left, choose the sales channel you want to add products to. +3. At the top right of the right section, click on the icon. +4. Choose from the dropdown list “Add products”. +5. This opens a window to add products with filters and search functionalities similar to those of a product page. Select the products you want to add to the sales channel. +6. Click Save. + +:::info + +Products in the list that are grayed out are products that are already added to the sales channel. + +::: + +--- + +## Remove Product from Sales Channel + +:::info + +If you remove a product from a sales channel, it will still be available in your ecommerce store, just not in that sales channel. You can also add the product again to the sales channel. + +::: + +To remove a product from a sales channel: + +1. Go to Settings → Sales Channels +2. In the sales channels list on the left, choose the sales channel you want to remove the product from. +3. Find the product you want to remove from the sales channel. +4. Click the icon at the right side of the product’s row. +5. Choose from the dropdown list “Remove from the channel”. \ No newline at end of file diff --git a/docs/content/user-guide/taxes/_category_.json b/docs/content/user-guide/taxes/_category_.json new file mode 100644 index 0000000000..ee18111438 --- /dev/null +++ b/docs/content/user-guide/taxes/_category_.json @@ -0,0 +1,6 @@ +{ + "position": 10, + "collapsed": false, + "link": null, + "label": "Taxes" +} \ No newline at end of file diff --git a/docs/content/user-guide/taxes/index.md b/docs/content/user-guide/taxes/index.md index c3a2cf6050..43550f0e75 100644 --- a/docs/content/user-guide/taxes/index.md +++ b/docs/content/user-guide/taxes/index.md @@ -1,3 +1,7 @@ +--- +sidebar_position: 1 +--- + # Taxes Overview In this document, you’ll get an overview of taxes in Medusa and learn about their importance in your ecommerce store. @@ -8,7 +12,7 @@ Taxes in Medusas are directly associated with [Regions](../regions/index.md). As Taxes are calculated for products and shipping methods on checkout. Medusa provides a default tax provider to calculate the taxes, and merchants and developers can also integrate custom tax providers for advanced calculation of taxes. -![A look at the Taxes page](https://i.imgur.com/JxwB8tu.png) +--- ## How are Taxes Created? @@ -16,14 +20,19 @@ Once a region is created, a default tax rate is created for that region. You can This also means that tax rates are deleted when a region is deleted. +--- + ## Customizing Tax Rates A region’s default tax rate is applied for all products and shipping options. You can also have more customized tax rates. Adding tax rates alongside the default one allows you to override the prices of specific products, product types, or shipping options. This further increase the customization capabilities of your ecommerce store. -![A look at tax rate overrides](https://i.imgur.com/KEDcYQT.png) +--- -## What More Can you Do with Taxes? +## Learn More About Taxes -In the Medusa admin, you can manage taxes and their settings, and apply further customizations to tax rates. You can learn more in [this guide](./manage.mdx). +- [Manage Taxes](./manage.md) +- [Manage Tax Rates](./tax-rates.mdx) +- [Manage Tax Overrides](./tax-overrides.mdx) +- [Tax Inclusive Pricing Overview](./tax-inclusive.md) diff --git a/docs/content/user-guide/taxes/manage.md b/docs/content/user-guide/taxes/manage.md new file mode 100644 index 0000000000..198162a422 --- /dev/null +++ b/docs/content/user-guide/taxes/manage.md @@ -0,0 +1,75 @@ +--- +sidebar_position: 2 +--- + +# Manage Taxes + +In this document, you’ll learn how to view and manage taxes in your Medusa Admin. + +## View Taxes + +To view taxes: + +1. Click on Settings in the sidebar. +2. Choose Tax Settings from the list of settings. + +This opens the Taxes page where you can find a list of regions. This is because every time you create a region, a default tax rate is associated with that region. + +--- + +## Edit a Region’s Taxes + +To edit a region’s taxes: + +1. Go to Settings → Taxes. +2. Click on the region you want to edit the taxes for in the Regions section. + +This opens a Details form to the right where you can edit the taxes calculation settings and manage the tax rates. + +--- + +## Change Tax Calculation Settings + +:::tip + +The save button only appears when you make changes to the settings. + +::: + +### Change Tax Provider + +The tax provider that you choose defines how taxes are calculated for products and shipping options on checkout. Medusa provides a default tax provider with the name “System Tax Provider”. + +If you have integrated a custom tax provider and want to use it to calculate taxes in a region: + +1. Select a region whose taxes you want to edit. +2. Change the selected tax provider in the Tax Provider field. +3. Click Save at the bottom right. + +### Disable Automatic Taxes Calculation + +By default, taxes are calculated automatically by Medusa. They’re calculated in different places during checkout, such as when a shipping method is chosen or when a new product is added to the cart. + +If you use a third-party tax provider and you want to avoid sending too many requests to the tax provider, you can disable this behavior. + +:::caution + +If you switch off automatic taxes calculation, the taxes must be calculated manually on checkout. If you’re unsure how that works, please contact your technical team. + +::: + +To disable automatic taxes calculation: + +1. Select a region whose tax you want to edit. +2. Check off the “Calculate taxes automatically” input. +3. Click Save at the bottom right. + +### Disable Taxes for Gift Cards + +To disable applying taxes for Gift Cards: + +1. Select a region whose tax you want to edit. +2. Check off the “Apply tax to gift cards” input. +3. Click Save at the bottom right. + +Enabling taxes for Gift Cards follows the same process, except you check the input. diff --git a/docs/content/user-guide/taxes/manage.mdx b/docs/content/user-guide/taxes/manage.mdx deleted file mode 100644 index 01a2091e67..0000000000 --- a/docs/content/user-guide/taxes/manage.mdx +++ /dev/null @@ -1,189 +0,0 @@ -import UiIcon from '@site/src/components/UiIcon'; - -# Manage Taxes - -In this document, you’ll learn how to view and manage taxes in your Medusa Admin. - -## View Taxes - -To view taxes: - -- Click on Settings in the sidebar. -- Choose Tax Settings from the list of settings. - -This opens the Taxes page where you can find a list of regions. This is because every time you create a region, a default tax rate is associated with that region. - -![List of Regions on the Taxes page](https://i.imgur.com/Hf3RazW.png) - -## Edit a Region’s Taxes - -To edit a region’s taxes: - -- Go to Settings → Taxes. -- Click on the region you want to edit the taxes for in the Regions section. - -This opens a Details form to the right where you can edit the taxes calculation settings and manage the tax rates. - -![The details of a region's taxes](https://i.imgur.com/kdLmcVA.png) - -## Change Tax Calculation Settings - -![Available settings to change tax calculation settings](https://i.imgur.com/y3UUE27.png) - -:::tip - -The save button only appears when you make changes to the settings. - -::: - -### Change Tax Provider - -The tax provider that you choose defines how taxes are calculated for products and shipping options on checkout. Medusa provides a default tax provider with the name “System Tax Provider”. - -If you have integrated a custom tax provider and want to use it to calculate taxes in a region: - -- Select a region whose taxes you want to edit. -- Change the selected tax provider in the Tax Provider field. -- Click Save at the bottom right. - -### Disable Automatic Taxes Calculation - -By default, taxes are calculated automatically by Medusa. They’re calculated in different places during checkout, such as when a shipping method is chosen or when a new product is added to the cart. - -If you use a third-party tax provider and you want to avoid sending too many requests to the tax provider, you can disable this behavior. - -:::caution - -If you switch off automatic taxes calculation, the taxes must be calculated manually on checkout. If you’re unsure how that works, please contact your technical team. - -::: - -To disable automatic taxes calculation: - -- Select a region whose tax you want to edit. -- Check off the “Calculate taxes automatically” input. -- Click Save at the bottom right. - -### Disable Taxes for Gift Cards - -To disable applying taxes for Gift Cards: - -- Select a region whose tax you want to edit. -- Check off the “Apply tax to gift cards” input. -- Click Save at the bottom right. - -Enabling taxes for Gift Cards follows the same process, except you check the input. - -## Manage Tax Rates - -Regions have at least one tax rate, which is the default tax rate. You can, however, add more tax rates for further customization. - -### Create Tax Rates - -To add a tax rate: - -- Select a region that you want to add a new tax rate to. -- Click on New Tax Rate at the top right of the Details section. -- This opens the tax rate form in a new window. -- You can optionally [add overrides to the tax rate](#manage-tax-rate-overrides). -- Once done, click Save. - -![Form to add a tax rate](https://i.imgur.com/y3UUE27.png) - -### Edit Tax Rate - -To edit a tax rate: - -- Select the region that the tax rate you want to edit belongs to. -- From the list of tax rates in the Details section, find the tax rate you want to edit and click the icon. -- Choose Edit from the dropdown. -- In the form that opens in the new window, you can edit the basic details of the tax rate such as the name or rate. If you’re editing a tax rate that’s not the default, you can [manage overrides of this tax rate](#manage-tax-rate-overrides). -- Once done, click Save. - -![Form to edit a tax rate](https://i.imgur.com/FG1Q1np.png) - -### Delete Tax Rate - -:::warning - -If you delete a tax rate, you won’t be able to restore it or use it during checkout. - -::: - -To delete a tax rate: - -- Select the region that the tax rate you want to delete belongs to. -- From the list of tax rates in the Details section, find the tax rate you want to delete and click the icon. -- Choose Delete Tax Rate from the dropdown. -- Confirm deleting the tax rate by clicking the “Yes, confirm” button in the pop-up. - -:::info - -Default tax rates can’t be deleted. If you don’t want to apply any taxes in a region, you can instead set the default tax rate to 0. - -::: - -![Delete tax rate link is the second link in the dropdown](https://i.imgur.com/MUarcT0.png) - -## Manage Tax Rate Overrides - -When you create or edit a tax rate, you can add, edit, and delete overrides. Overrides are used to customize the default tax rate for some products, product types, or shipping options. - -### Override Types - -There are three override types: - -- **Products**: Used to override the tax rate applied on specific products during checkout. -- **Product Types:** Used to override the tax rate applied on a product type. This subsequently overrides the tax rate of any product having this type during checkout. -- **Shipping Options:** Used to override the tax rate applied on selected shipping methods during checkout. - -### Add Override - -To add an override while adding or editing a tax rate: - -- Under the Overrides section, click Add Overrides -- Choose the type of the override, then choose the specific entries in that type that you want to apply the tax rate to. For example, if you chose the Products type, choose at least one product to apply the override to. -- Once done, click on Add. -- In the tax rate form, click on Save. - -:::info - -If you already have an override for one of the types, and you choose to add a new override for that same type, the new override replaces the old one. If you want to add new entries to the same type (for example, add more products to the Products override), you should [edit the existing override](#edit-override) instead. - -::: - -![Form to add an override](https://i.imgur.com/xIP8gnb.png) - -### Edit Override - -You can edit an override to select more entries for or remove entries from an override type. - -To edit an override: - -- Open the edit form of a tax rate. -- Under the overrides section, find the override type you want to edit. For example, if you want to add a product to the overrides, find the override with the title “Product Rules”. -- Click on the three dots next to the override type. -- Choose Edit from the dropdown. -- You can then change the selected entries for the override type. -- Once done, click Add. -- In the edit form of the tax rate, click Save. - -![Edit link is the first link in the dropdown](https://i.imgur.com/1qE7vyF.png) - -### Delete Override - -:::caution - -If you delete an override you won’t be able to restore it and it won’t be applied during checkout. If you want to, instead, remove some entries from an override type, you should [edit the override](#edit-override) instead. - -::: - -To delete an override: - -- Open the edit form of a tax rate. -- Under the overrides section, find the override type you want to delete. -- Click on the three dots next to the override type. -- Choose "Delete rule" from the dropdown. -- Click Save. - -![Delete rule link is the second link in the dropdown](https://i.imgur.com/c8yEmrD.png) \ No newline at end of file diff --git a/docs/content/user-guide/taxes/tax-inclusive.md b/docs/content/user-guide/taxes/tax-inclusive.md new file mode 100644 index 0000000000..071dcca614 --- /dev/null +++ b/docs/content/user-guide/taxes/tax-inclusive.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 5 +--- + +# Tax Inclusive Pricing Overview + +:::note + +This guide is coming soon. + +::: diff --git a/docs/content/user-guide/taxes/tax-overrides.mdx b/docs/content/user-guide/taxes/tax-overrides.mdx new file mode 100644 index 0000000000..65bcef961a --- /dev/null +++ b/docs/content/user-guide/taxes/tax-overrides.mdx @@ -0,0 +1,78 @@ +--- +sidebar_position: 4 +--- + +import UiIcon from '@site/src/components/UiIcon'; + +# Manage Tax Overrides + +In this document, you’ll learn how to manage tax overrides in your Medusa Admin. + +## Overview + +When you create or edit a [tax rate](./tax-rates.mdx), you can add, edit, and delete overrides. Overrides are used to customize the tax rate applied for some products, product types, or shipping options. + +### Override Types + +There are three override types: + +1. **Products**: Used to override the tax rate applied on specific products during checkout. +2. **Product Types:** Used to override the tax rate applied on a product type. This subsequently overrides the tax rate of any product having this type during checkout. +3. **Shipping Options:** Used to override the tax rate applied on selected shipping methods during checkout. + +--- + +## Add Override + +To add an override while [adding or editing a tax rate](./tax-rates.mdx#create-tax-rate): + +1. Go to Settings → Taxes +2. Select the region that the tax rate you want to edit belongs to. +3. Under the Overrides section, click Add Overrides +4. Choose the type of the override, then choose the specific entries in that type that you want to apply the tax rate to. For example, if you chose the Products type, choose at least one product to apply the override to. +5. Once done, click on Add. +6. In the tax rate form, click on Save. + +:::info + +If you already have an override for one of the types, and you choose to add a new override for that same type, the new override replaces the old one. If you want to add new entries to the same type (for example, add more products to the Products override), you should edit the existing override instead. + +::: + +--- + +## Edit Override + +You can edit an override to select more entries for or remove entries from an override type. + +To edit an override: + +1. Go to Settings → Taxes +2. Select the region that the tax rate you want to edit belongs to. +3. From the list of tax rates in the Details section, find the tax rate that the override you want to edit belongs to and click the icon. +4. Under the overrides section, find the override type you want to edit. For example, if you want to add a product to the overrides, find the override with the title “Product Rules”. +5. Click on the icon next to the override type. +6. Choose Edit from the dropdown. +7. You can then change the selected entries for the override type. +8. Once done, click Add. +9. In the edit form of the tax rate, click Save. + +--- + +## Delete Override + +:::caution + +If you delete an override you won’t be able to restore it and it won’t be applied during checkout. If you want to, instead, remove some entries from an override type, you should edit the override instead. + +::: + +To delete an override: + +1. Go to Settings → Taxes +2. Select the region that the tax rate you want to edit belongs to. +3. From the list of tax rates in the Details section, find the tax rate that the override you want to delete belongs to and click the icon. +4. Under the overrides section, find the override type you want to delete. +5. Click on the icon next to the override type. +6. Choose “Delete rule” from the dropdown. +7. Click Save. diff --git a/docs/content/user-guide/taxes/tax-rates.mdx b/docs/content/user-guide/taxes/tax-rates.mdx new file mode 100644 index 0000000000..eeee54464c --- /dev/null +++ b/docs/content/user-guide/taxes/tax-rates.mdx @@ -0,0 +1,63 @@ +--- +sidebar_position: 3 +--- + +import UiIcon from '@site/src/components/UiIcon'; + +# Manage Tax Rates + +In this document, you’ll learn how to manage tax rates in your Medusa Admin. + +## Overview + +Regions have at least one tax rate, which is the default tax rate. You can, however, add more tax rates for further customization. You can also edit or delete tax rates. + +--- + +## Create Tax Rates + +To add a tax rate: + +1. Go to Settings → Taxes +2. Select a region that you want to add a new tax rate to. +3. Click on New Tax Rate at the top right of the Details section. +4. This opens the tax rate form in a new window. +5. You can optionally [add overrides to the tax rate](./tax-overrides.mdx). +6. Once done, click Save. + +--- + +## Edit Tax Rate + +To edit a tax rate: + +1. Go to Settings → Taxes +2. Select the region that the tax rate you want to edit belongs to. +3. From the list of tax rates in the Details section, find the tax rate you want to edit and click the icon. +4. Choose Edit from the dropdown. +5. In the form that opens in the new window, you can edit the basic details of the tax rate such as the name or rate. If you’re editing a tax rate that’s not the default, you can [manage overrides of this tax rate](./tax-overrides.mdx). +6. Once done, click Save. + +--- + +## Delete Tax Rate + +:::warning + +If you delete a tax rate, you won’t be able to restore it or use it during checkout. + +::: + +To delete a tax rate: + +1. Go to Settings → Taxes +2. Select the region that the tax rate you want to delete belongs to. +3. From the list of tax rates in the Details section, find the tax rate you want to delete and click the icon. +4. Choose Delete Tax Rate from the dropdown. +5. Confirm deleting the tax rate by clicking the “Yes, confirm” button in the pop-up. + +:::info + +Default tax rates can’t be deleted. If you don’t want to apply any taxes in a region, you can instead set the default tax rate to 0. + +::: \ No newline at end of file diff --git a/packages/medusa/src/api/middlewares/await-middleware.ts b/packages/medusa/src/api/middlewares/await-middleware.ts index f9e02e8a6c..3f1b4edb09 100644 --- a/packages/medusa/src/api/middlewares/await-middleware.ts +++ b/packages/medusa/src/api/middlewares/await-middleware.ts @@ -15,3 +15,18 @@ export default (fn: handler): RequestHandler => { return fn(req, res).catch(next) } } + +/** + * @schema multiple_errors + * title: "Multiple Errors" + * x-resourceId: multiple_errors + * 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" + */ \ No newline at end of file diff --git a/packages/medusa/src/api/middlewares/error-handler.ts b/packages/medusa/src/api/middlewares/error-handler.ts index 6690665915..14001b33b4 100644 --- a/packages/medusa/src/api/middlewares/error-handler.ts +++ b/packages/medusa/src/api/middlewares/error-handler.ts @@ -67,3 +67,19 @@ export default () => { res.status(statusCode).json(errObj) } } + +/** + * @schema error + * title: "Response Error" + * x-resourceId: error + * 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. + */ \ No newline at end of file diff --git a/packages/medusa/src/api/routes/admin/apps/authorize-app.ts b/packages/medusa/src/api/routes/admin/apps/authorize-app.ts index 38634e9109..65b126b150 100644 --- a/packages/medusa/src/api/routes/admin/apps/authorize-app.ts +++ b/packages/medusa/src/api/routes/admin/apps/authorize-app.ts @@ -27,6 +27,21 @@ import { validator } from "../../../../utils/validator" * code: * type: string * description: The code for the generated token. + * 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: @@ -38,6 +53,18 @@ import { validator } from "../../../../utils/validator" * properties: * apps: * $ref: "#/components/schemas/OAuth" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostAppsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/apps/list.ts b/packages/medusa/src/api/routes/admin/apps/list.ts index ab452a5f09..69e7ea67fe 100644 --- a/packages/medusa/src/api/routes/admin/apps/list.ts +++ b/packages/medusa/src/api/routes/admin/apps/list.ts @@ -6,6 +6,15 @@ import { OauthService } from "../../../../services" * summary: "List applications" * description: "Retrieve a list of applications." * x-authenticated: true + * 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: @@ -19,6 +28,18 @@ import { OauthService } from "../../../../services" * type: array * items: * $ref: "#/components/schemas/OAuth" + * "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" */ export default async (req, res) => { const oauthService: OauthService = req.scope.resolve("oauthService") diff --git a/packages/medusa/src/api/routes/admin/auth/create-session.ts b/packages/medusa/src/api/routes/admin/auth/create-session.ts index 11fe81f142..e0339c653a 100644 --- a/packages/medusa/src/api/routes/admin/auth/create-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/create-session.ts @@ -32,6 +32,27 @@ import { validator } from "../../../../utils/validator" * type: string * description: The User's password. * format: password + * 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: @@ -43,8 +64,18 @@ import { validator } from "../../../../utils/validator" * properties: * user: * $ref: "#/components/schemas/user" + * "400": + * $ref: "#/components/responses/400_error" * "401": - * description: The user doesn't exist or the credentials are incorrect. + * $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" */ export default async (req, res) => { const { projectConfig: { jwt_secret } } = req.scope.resolve('configModule') diff --git a/packages/medusa/src/api/routes/admin/auth/delete-session.ts b/packages/medusa/src/api/routes/admin/auth/delete-session.ts index 8760fe1d3c..3a87ee4196 100644 --- a/packages/medusa/src/api/routes/admin/auth/delete-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/delete-session.ts @@ -4,11 +4,39 @@ * summary: "Delete Session" * x-authenticated: true * description: "Deletes the current session for the logged in user." + * 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" */ export default async (req, res) => { req.session.destroy() diff --git a/packages/medusa/src/api/routes/admin/auth/get-session.ts b/packages/medusa/src/api/routes/admin/auth/get-session.ts index a694525fa0..1e36a9e616 100644 --- a/packages/medusa/src/api/routes/admin/auth/get-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/get-session.ts @@ -7,6 +7,25 @@ import _ from "lodash" * summary: "Get Session" * x-authenticated: true * description: "Gets the currently logged in User." + * 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: @@ -19,7 +38,17 @@ import _ from "lodash" * user: * $ref: "#/components/schemas/user" * "400": - * description: An error occurred. + * $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" */ export default async (req, res) => { try { diff --git a/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts index af582be151..21dd02012d 100644 --- a/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts @@ -9,6 +9,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the batch job. + * 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: @@ -20,6 +39,18 @@ import { EntityManager } from "typeorm" * properties: * batch_job: * $ref: "#/components/schemas/batch_job" + * "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" */ export default async (req, res) => { let batch_job = req.batch_job diff --git a/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts index 7601b105c6..3cafd8ff6e 100644 --- a/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts @@ -9,6 +9,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the batch job. + * 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: @@ -20,6 +39,18 @@ import { EntityManager } from "typeorm" * properties: * batch_job: * $ref: "#/components/schemas/batch_job" + * "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" */ export default async (req, res) => { let batch_job = req.batch_job diff --git a/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts index 6eff9eb59e..498df2c1c0 100644 --- a/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts @@ -46,6 +46,33 @@ import { validator } from "../../../../utils/validator" * 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 + * 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: @@ -57,6 +84,18 @@ import { validator } from "../../../../utils/validator" * properties: * batch_job: * $ref: "#/components/schemas/batch_job" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostBatchesReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts index 2c16bccba9..5884d210e4 100644 --- a/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts @@ -6,6 +6,25 @@ * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Batch Job + * 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: @@ -17,6 +36,18 @@ * properties: * batch_job: * $ref: "#/components/schemas/batch_job" + * "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" */ export default async (req, res) => { const batch_job = req.batch_job diff --git a/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts b/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts index 2360fc801d..5ef8a2b092 100644 --- a/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts +++ b/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts @@ -210,6 +210,25 @@ import { isDefined } from "../../../../utils" * type: string * description: filter by dates greater than or equal to this date * format: date + * 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: @@ -232,6 +251,18 @@ import { isDefined } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res) => { const batchService: BatchJobService = req.scope.resolve("batchJobService") diff --git a/packages/medusa/src/api/routes/admin/collections/add-products.ts b/packages/medusa/src/api/routes/admin/collections/add-products.ts index d1925f2f10..02a3d2d773 100644 --- a/packages/medusa/src/api/routes/admin/collections/add-products.ts +++ b/packages/medusa/src/api/routes/admin/collections/add-products.ts @@ -25,6 +25,21 @@ import ProductCollectionService from "../../../../services/product-collection" * items: * description: "The ID of a Product to add to the Product Collection." * type: string + * 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: @@ -36,6 +51,18 @@ import ProductCollectionService from "../../../../services/product-collection" * properties: * collection: * $ref: "#/components/schemas/product_collection" + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/collections/create-collection.ts b/packages/medusa/src/api/routes/admin/collections/create-collection.ts index 415a7299d6..d232e1edaf 100644 --- a/packages/medusa/src/api/routes/admin/collections/create-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/create-collection.ts @@ -25,6 +25,31 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -36,6 +61,18 @@ import { EntityManager } from "typeorm" * properties: * collection: * $ref: "#/components/schemas/product_collection" + * "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" */ export default async (req: Request, res: Response) => { const { validatedBody } = req as { validatedBody: AdminPostCollectionsReq } diff --git a/packages/medusa/src/api/routes/admin/collections/delete-collection.ts b/packages/medusa/src/api/routes/admin/collections/delete-collection.ts index e31a668871..963d6212dc 100644 --- a/packages/medusa/src/api/routes/admin/collections/delete-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/delete-collection.ts @@ -11,6 +11,25 @@ import ProductCollectionService from "../../../../services/product-collection" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Collection. + * 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: @@ -31,6 +50,18 @@ import ProductCollectionService from "../../../../services/product-collection" * type: boolean * description: Whether the collection was deleted successfully or not. * 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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/collections/get-collection.ts b/packages/medusa/src/api/routes/admin/collections/get-collection.ts index 76d47cac74..96c404d449 100644 --- a/packages/medusa/src/api/routes/admin/collections/get-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/get-collection.ts @@ -10,6 +10,25 @@ import { defaultAdminCollectionsRelations } from "." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Product Collection + * 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: @@ -21,6 +40,18 @@ import { defaultAdminCollectionsRelations } from "." * properties: * collection: * $ref: "#/components/schemas/product_collection" + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/collections/list-collections.ts b/packages/medusa/src/api/routes/admin/collections/list-collections.ts index a25b1ec741..82e9ce6afc 100644 --- a/packages/medusa/src/api/routes/admin/collections/list-collections.ts +++ b/packages/medusa/src/api/routes/admin/collections/list-collections.ts @@ -84,6 +84,25 @@ import { Type } from "class-transformer" * type: string * description: filter by dates greater than or equal to this date * format: date + * 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: @@ -106,6 +125,18 @@ import { Type } from "class-transformer" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res: Response) => { const productCollectionService: ProductCollectionService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/collections/remove-products.ts b/packages/medusa/src/api/routes/admin/collections/remove-products.ts index a2b155d541..a1e95e0563 100644 --- a/packages/medusa/src/api/routes/admin/collections/remove-products.ts +++ b/packages/medusa/src/api/routes/admin/collections/remove-products.ts @@ -25,6 +25,21 @@ import ProductCollectionService from "../../../../services/product-collection" * items: * description: "The ID of a Product to add to the Product Collection." * type: string + * 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: @@ -47,6 +62,18 @@ import ProductCollectionService from "../../../../services/product-collection" * items: * description: "The ID of a Product to add to the Product Collection." * type: string + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/collections/update-collection.ts b/packages/medusa/src/api/routes/admin/collections/update-collection.ts index d7773136e6..dd90c1323f 100644 --- a/packages/medusa/src/api/routes/admin/collections/update-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/update-collection.ts @@ -25,6 +25,31 @@ import ProductCollectionService from "../../../../services/product-collection" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -36,6 +61,18 @@ import ProductCollectionService from "../../../../services/product-collection" * properties: * collection: * $ref: "#/components/schemas/product_collection" + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts b/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts index 4727317073..16df1ea384 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts @@ -32,6 +32,39 @@ import { validator } from "../../../../utils/validator" * id: * description: ID of the customer * 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.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: @@ -43,6 +76,18 @@ import { validator } from "../../../../utils/validator" * properties: * customer_group: * $ref: "#/components/schemas/customer_group" + * "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" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts index bec19a5376..0b3fb044c5 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts @@ -14,6 +14,31 @@ import { validator } from "../../../../utils/validator" * parameters: * - (body) name=* {string} Name of the customer group * - (body) metadata {object} Metadata for the customer. + * 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: @@ -25,6 +50,18 @@ import { validator } from "../../../../utils/validator" * properties: * customer_group: * $ref: "#/components/schemas/customer_group" + * "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" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts index 495f2edb70..8d1264bbf7 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts @@ -11,6 +11,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Customer Group + * 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: @@ -31,6 +50,18 @@ import { EntityManager } from "typeorm" * type: boolean * description: Whether the customer group was deleted successfully or not. * 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" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts b/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts index edfcf63327..ff6fe76a25 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts @@ -32,6 +32,39 @@ import { validator } from "../../../../utils/validator" * id: * description: ID of the customer * 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.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: @@ -43,6 +76,18 @@ import { validator } from "../../../../utils/validator" * properties: * customer_group: * $ref: "#/components/schemas/customer_group" + * "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" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts index 43ea70b869..73d4d4c501 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts @@ -10,6 +10,25 @@ import CustomerController from "../../../../controllers/customers" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the customer group. + * 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: @@ -32,6 +51,18 @@ import CustomerController from "../../../../controllers/customers" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts index ef355ad106..dc31c59c23 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts @@ -13,6 +13,25 @@ import { FindParams } from "../../../../types/common" * - (path) id=* {string} The ID of the Customer Group. * - (query) expand {string} (Comma separated) Which fields should be expanded in the customer group. * - (query) fields {string} (Comma separated) Which fields should be included in the customer group. + * 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: @@ -24,6 +43,18 @@ import { FindParams } from "../../../../types/common" * properties: * customer_group: * $ref: "#/components/schemas/customer_group" + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts b/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts index b0ce19e49e..84b50f76e1 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts @@ -99,7 +99,25 @@ import { Type } from "class-transformer" * format: date * - (query) limit=10 {integer} Limit the number of customer groups returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each customer groups of the result. - + * 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.id); + * }); + * - 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: @@ -122,6 +140,18 @@ import { Type } from "class-transformer" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res: Response) => { const customerGroupService: CustomerGroupService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts index 54313279ff..6b39ea2355 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts @@ -26,6 +26,31 @@ import { validator } from "../../../../utils/validator" * metadata: * description: "Metadata for the customer." * type: object + * 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: @@ -37,6 +62,18 @@ import { validator } from "../../../../utils/validator" * properties: * customer_group: * $ref: "#/components/schemas/customer_group" + * "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" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customers/create-customer.ts b/packages/medusa/src/api/routes/admin/customers/create-customer.ts index e26d2a6117..9d3d7cf6e6 100644 --- a/packages/medusa/src/api/routes/admin/customers/create-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/create-customer.ts @@ -42,6 +42,37 @@ import { EntityManager } from "typeorm" * type: object * tags: * - Customer + * 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: [] * responses: * 201: * description: OK @@ -51,6 +82,18 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostCustomersReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/customers/get-customer.ts b/packages/medusa/src/api/routes/admin/customers/get-customer.ts index d388b1a884..85c997eb6a 100644 --- a/packages/medusa/src/api/routes/admin/customers/get-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/get-customer.ts @@ -13,6 +13,25 @@ import { validator } from "../../../../utils/validator" * - (path) id=* {string} The ID of the Customer. * - (query) expand {string} (Comma separated) Which fields should be expanded in the customer. * - (query) fields {string} (Comma separated) Which fields should be included in the customer. + * 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: @@ -24,6 +43,18 @@ import { validator } from "../../../../utils/validator" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/customers/list-customers.ts b/packages/medusa/src/api/routes/admin/customers/list-customers.ts index 896b6a1932..757f2a637e 100644 --- a/packages/medusa/src/api/routes/admin/customers/list-customers.ts +++ b/packages/medusa/src/api/routes/admin/customers/list-customers.ts @@ -16,6 +16,25 @@ import customerController from "../../../../controllers/customers" * - (query) expand {string} (Comma separated) Which fields should be expanded in each customer. * - (query) q {string} a search term to search email, first_name, and last_name. * - (query) groups[] {string} group IDs to search customers by. + * 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: @@ -38,6 +57,18 @@ import customerController from "../../../../controllers/customers" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const result = await customerController.listAndCount( diff --git a/packages/medusa/src/api/routes/admin/customers/update-customer.ts b/packages/medusa/src/api/routes/admin/customers/update-customer.ts index 975d6e93f2..8880651745 100644 --- a/packages/medusa/src/api/routes/admin/customers/update-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/update-customer.ts @@ -60,6 +60,31 @@ import { validator } from "../../../../utils/validator" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -71,6 +96,18 @@ import { validator } from "../../../../utils/validator" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/add-region.ts b/packages/medusa/src/api/routes/admin/discounts/add-region.ts index 226f35e95e..957061cb7c 100644 --- a/packages/medusa/src/api/routes/admin/discounts/add-region.ts +++ b/packages/medusa/src/api/routes/admin/discounts/add-region.ts @@ -13,6 +13,25 @@ import { EntityManager } from "typeorm" * parameters: * - (path) id=* {string} The ID of the Discount. * - (path) region_id=* {string} The ID of the Region. + * 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: @@ -24,6 +43,18 @@ import { EntityManager } from "typeorm" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id, region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/create-condition.ts b/packages/medusa/src/api/routes/admin/discounts/create-condition.ts index a6189525ff..5018ed4fe5 100644 --- a/packages/medusa/src/api/routes/admin/discounts/create-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/create-condition.ts @@ -55,7 +55,32 @@ import { validator } from "../../../../utils/validator" * description: list of customer group IDs if the condition is applied on customer groups. * items: * type: string - + * 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: @@ -67,6 +92,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/create-discount.ts b/packages/medusa/src/api/routes/admin/discounts/create-discount.ts index bbf84f8305..1980d7e715 100644 --- a/packages/medusa/src/api/routes/admin/discounts/create-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/create-discount.ts @@ -139,6 +139,44 @@ import { validator } from "../../../../utils/validator" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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 + * }, + * 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" + * } + * }' + * security: + * - api_token: [] + * - cookie_auth: [] * tags: * - Discount * responses: @@ -150,6 +188,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts b/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts index 5dabee0b00..5a96802261 100644 --- a/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts +++ b/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts @@ -22,6 +22,32 @@ import { validator } from "../../../../utils/validator" * - (body) code=* {string} The unique code that will be used to redeem the Discount. * - (body) usage_limit=1 {number} amount of times the discount can be applied. * - (body) metadata {object} An optional set of key-value paris to hold additional information. + * 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: @@ -33,6 +59,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts b/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts index bc0a119dd4..4cfd133f7b 100644 --- a/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts @@ -20,6 +20,25 @@ import { validator } from "../../../../utils/validator" * - (path) condition_id=* {string} The ID of the DiscountCondition * - (query) expand {string} Comma separated list of relations to include in the results. * - (query) fields {string} Comma separated list of fields to include in the results. + * 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: @@ -43,6 +62,18 @@ import { validator } from "../../../../utils/validator" * discount: * description: The Discount to which the condition used to belong * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id, condition_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts b/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts index 04100d530b..93632a7711 100644 --- a/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts @@ -9,6 +9,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Discount + * 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: @@ -29,6 +48,18 @@ import { EntityManager } from "typeorm" * type: boolean * description: Whether the discount was deleted successfully or not. * 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" */ export default async (req, res) => { const { discount_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts b/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts index 8e4b62e7b6..c2308d758c 100644 --- a/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts +++ b/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts @@ -12,6 +12,25 @@ import { EntityManager } from "typeorm" * parameters: * - (path) id=* {string} The ID of the Discount * - (path) code=* {string} The ID of the Discount + * 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: @@ -23,6 +42,18 @@ import { EntityManager } from "typeorm" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id, code } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/get-condition.ts b/packages/medusa/src/api/routes/admin/discounts/get-condition.ts index 687a42bcea..aed2572d74 100644 --- a/packages/medusa/src/api/routes/admin/discounts/get-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/get-condition.ts @@ -15,14 +15,32 @@ import { validator } from "../../../../utils/validator" * @oas [get] /discounts/{discount_id}/conditions/{condition_id} * operationId: "GetDiscountsDiscountConditionsCondition" * summary: "Gets a DiscountCondition" + * description: "Gets a DiscountCondition" * x-authenticated: true * parameters: * - (path) discount_id=* {string} The ID of the Discount. * - (path) condition_id=* {string} The ID of the DiscountCondition. * - (query) expand {string} Comma separated list of relations to include in the results. * - (query) fields {string} Comma separated list of fields to include in the results. - * description: "Gets a DiscountCondition" - + * 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: @@ -34,6 +52,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount_condition: * $ref: "#/components/schemas/discount_condition" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts b/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts index 160479a6c9..3abfd3e3a5 100644 --- a/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts +++ b/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts @@ -15,6 +15,25 @@ import { validator } from "../../../../utils/validator" * - (path) code=* {string} The code of the Discount * - (query) expand {string} Comma separated list of relations to include in the results. * - (query) fields {string} Comma separated list of fields to include in the results. + * 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: @@ -26,6 +45,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { code } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/get-discount.ts b/packages/medusa/src/api/routes/admin/discounts/get-discount.ts index a410999366..ea9061449f 100644 --- a/packages/medusa/src/api/routes/admin/discounts/get-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/get-discount.ts @@ -15,6 +15,25 @@ import { validator } from "../../../../utils/validator" * - (path) id=* {string} The ID of the Discount * - (query) expand {string} Comma separated list of relations to include in the results. * - (query) fields {string} Comma separated list of fields to include in the results. + * 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: @@ -26,6 +45,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts b/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts index 7a725db09a..5aa78af038 100644 --- a/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts +++ b/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts @@ -43,6 +43,25 @@ import { isDefined } from "../../../../utils" * - (query) limit=20 {number} The number of items in the response * - (query) offset=0 {number} The offset of items in response * - (query) expand {string} Comma separated list of relations to include in the results. + * 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: @@ -65,6 +84,18 @@ import { isDefined } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const validated = await validator(AdminGetDiscountsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/discounts/remove-region.ts b/packages/medusa/src/api/routes/admin/discounts/remove-region.ts index a273fdc1c2..445244ec79 100644 --- a/packages/medusa/src/api/routes/admin/discounts/remove-region.ts +++ b/packages/medusa/src/api/routes/admin/discounts/remove-region.ts @@ -12,6 +12,25 @@ import { EntityManager } from "typeorm" * parameters: * - (path) id=* {string} The ID of the Discount. * - (path) region_id=* {string} The ID of the Region. + * 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: @@ -23,6 +42,18 @@ import { EntityManager } from "typeorm" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id, region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/update-condition.ts b/packages/medusa/src/api/routes/admin/discounts/update-condition.ts index b172fdaaa2..bcc2f181fb 100644 --- a/packages/medusa/src/api/routes/admin/discounts/update-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/update-condition.ts @@ -50,6 +50,35 @@ import { validator } from "../../../../utils/validator" * description: list of customer group IDs if the condition is applied on customer groups. * items: * 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.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: @@ -61,6 +90,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/discounts/update-discount.ts b/packages/medusa/src/api/routes/admin/discounts/update-discount.ts index 3d465e4f75..0078ab7f44 100644 --- a/packages/medusa/src/api/routes/admin/discounts/update-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/update-discount.ts @@ -127,6 +127,31 @@ import { validator } from "../../../../utils/validator" * metadata: * description: An object containing metadata of the discount * type: object + * 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: @@ -138,6 +163,18 @@ import { validator } from "../../../../utils/validator" * properties: * discount: * $ref: "#/components/schemas/discount" + * "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" */ export default async (req, res) => { const { discount_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts index 259850f190..84e11460bb 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts @@ -116,6 +116,53 @@ import { validator } from "../../../../utils/validator" * metadata: * description: The optional key-value map with additional details about the Draft Order. * type: object + * 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: @@ -127,6 +174,18 @@ import { validator } from "../../../../utils/validator" * properties: * draft_order: * $ref: "#/components/schemas/draft-order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts b/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts index e44168070d..c25ad0bbac 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts @@ -52,6 +52,31 @@ import { validator } from "../../../../utils/validator" * metadata: * description: The optional key-value map with additional details about the Line Item. * type: object + * 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: @@ -63,6 +88,18 @@ import { validator } from "../../../../utils/validator" * properties: * draft_order: * $ref: "#/components/schemas/draft-order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts index bf5ec150e0..472fa3aa49 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts @@ -8,6 +8,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Draft Order. + * 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: @@ -28,6 +47,18 @@ import { EntityManager } from "typeorm" * type: boolean * description: Whether the draft order was deleted successfully or not. * 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts b/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts index fc5308fb22..f42b536121 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts @@ -18,6 +18,25 @@ import { MedusaError } from "medusa-core-utils" * parameters: * - (path) id=* {string} The ID of the Draft Order. * - (path) line_id=* {string} The ID of the Draft Order. + * 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: @@ -29,6 +48,18 @@ import { MedusaError } from "medusa-core-utils" * properties: * draft_order: * $ref: "#/components/schemas/draft-order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts index 279de073c2..ee80b5fa79 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts @@ -16,6 +16,25 @@ import { DraftOrder } from "../../../.." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Draft Order. + * 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: @@ -27,6 +46,18 @@ import { DraftOrder } from "../../../.." * properties: * draft_order: * $ref: "#/components/schemas/draft-order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts b/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts index 9762118051..3d5ab61be0 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts @@ -21,6 +21,25 @@ import { validator } from "../../../../utils/validator" * - (query) offset=0 {number} The number of items to skip before the results. * - (query) limit=50 {number} Limit the number of items returned. * - (query) q {string} a search term to search emails in carts associated with draft orders and display IDs of draft orders + * 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: @@ -43,6 +62,18 @@ import { validator } from "../../../../utils/validator" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts b/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts index 702af23ff1..3f1a425c45 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts @@ -19,6 +19,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {String} The Draft Order id. + * 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: @@ -30,6 +49,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/draft-order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts index a80f826440..721c815c0c 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts @@ -68,6 +68,31 @@ import { validator } from "../../../../utils/validator" * customer_id: * description: "The ID of the Customer to associate the Draft Order with." * 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.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: @@ -79,6 +104,18 @@ import { validator } from "../../../../utils/validator" * properties: * draft_order: * $ref: "#/components/schemas/draft-order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts b/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts index 7ccb96cb62..6a51c3a9d0 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts @@ -38,6 +38,31 @@ import { validator } from "../../../../utils/validator" * metadata: * description: The optional key-value map with additional details about the Line Item. * type: object + * 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: @@ -49,6 +74,18 @@ import { validator } from "../../../../utils/validator" * properties: * draft_order: * $ref: "#/components/schemas/draft-order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts index bc3733357f..55ace20dac 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts @@ -35,6 +35,31 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -46,6 +71,18 @@ import { EntityManager } from "typeorm" * properties: * gift_card: * $ref: "#/components/schemas/gift_card" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostGiftCardsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts index 9bd27d7582..e6d7715587 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts @@ -8,6 +8,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Gift Card to 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: @@ -28,6 +47,18 @@ import { EntityManager } from "typeorm" * type: boolean * description: Whether the gift card was deleted successfully or not. * 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts index aed27a2b0d..c1366fd520 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts @@ -8,6 +8,25 @@ import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "./" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Gift Card. + * 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: @@ -19,6 +38,18 @@ import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "./" * properties: * gift_card: * $ref: "#/components/schemas/gift_card" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts b/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts index fb1e373337..b5ab702437 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts @@ -16,6 +16,25 @@ import { isDefined } from "../../../../utils" * - (query) offset=0 {number} The number of items to skip before the results. * - (query) limit=50 {number} Limit the number of items returned. * - (query) q {string} a search term to search by code or display ID + * 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: @@ -38,6 +57,18 @@ import { isDefined } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const validated = await validator(AdminGetGiftCardsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts index 9ba5815d52..a9156346f3 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts @@ -35,6 +35,31 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -46,6 +71,18 @@ import { EntityManager } from "typeorm" * properties: * gift_card: * $ref: "#/components/schemas/gift_card" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/invites/accept-invite.ts b/packages/medusa/src/api/routes/admin/invites/accept-invite.ts index 6f21d6d3ed..a00ea52dbd 100644 --- a/packages/medusa/src/api/routes/admin/invites/accept-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/accept-invite.ts @@ -39,11 +39,61 @@ import { EntityManager } from "typeorm" * description: The desired password for the User * type: string * format: password + * 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" */ export default async (req, res) => { const validated = await validator(AdminPostInvitesInviteAcceptReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/invites/create-invite.ts b/packages/medusa/src/api/routes/admin/invites/create-invite.ts index 6343f4e293..1d8e6aee59 100644 --- a/packages/medusa/src/api/routes/admin/invites/create-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/create-invite.ts @@ -27,11 +27,53 @@ import { EntityManager } from "typeorm" * description: "The role of the user to be created." * type: string * enum: [admin, member, developer] + * 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" */ export default async (req, res) => { const validated = await validator(AdminPostInvitesReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/invites/delete-invite.ts b/packages/medusa/src/api/routes/admin/invites/delete-invite.ts index 17e527a998..c53a1026cf 100644 --- a/packages/medusa/src/api/routes/admin/invites/delete-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/delete-invite.ts @@ -9,6 +9,25 @@ import InviteService from "../../../../services/invite" * x-authenticated: true * parameters: * - (path) invite_id=* {string} The ID of the Invite + * 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: @@ -29,6 +48,18 @@ import InviteService from "../../../../services/invite" * type: boolean * description: Whether or not the Invite 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" */ export default async (req, res) => { const { invite_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/invites/list-invites.ts b/packages/medusa/src/api/routes/admin/invites/list-invites.ts index 2d9182219a..a859fa3923 100644 --- a/packages/medusa/src/api/routes/admin/invites/list-invites.ts +++ b/packages/medusa/src/api/routes/admin/invites/list-invites.ts @@ -6,6 +6,25 @@ import InviteService from "../../../../services/invite" * summary: "Lists all Invites" * description: "Lists all Invites" * x-authenticated: true + * 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: @@ -19,6 +38,18 @@ import InviteService from "../../../../services/invite" * type: array * items: * $ref: "#/components/schemas/invite" + * "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" */ export default async (req, res) => { const inviteService: InviteService = req.scope.resolve("inviteService") diff --git a/packages/medusa/src/api/routes/admin/invites/resend-invite.ts b/packages/medusa/src/api/routes/admin/invites/resend-invite.ts index 0dd0798008..3a52f6e213 100644 --- a/packages/medusa/src/api/routes/admin/invites/resend-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/resend-invite.ts @@ -9,11 +9,45 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) invite_id=* {string} The ID of the Invite + * 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" */ export default async (req, res) => { const { invite_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/notes/create-note.ts b/packages/medusa/src/api/routes/admin/notes/create-note.ts index df9f8dad4b..bb9bbf899f 100644 --- a/packages/medusa/src/api/routes/admin/notes/create-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/create-note.ts @@ -28,6 +28,35 @@ import { EntityManager } from "typeorm" * value: * type: string * description: The content of the Note to 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: @@ -39,6 +68,18 @@ import { EntityManager } from "typeorm" * properties: * note: * $ref: "#/components/schemas/note" + * "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" * */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/notes/delete-note.ts b/packages/medusa/src/api/routes/admin/notes/delete-note.ts index 26db70f0d3..f427060d3b 100644 --- a/packages/medusa/src/api/routes/admin/notes/delete-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/delete-note.ts @@ -9,6 +9,25 @@ import NoteService from "../../../../services/note" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Note to 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: @@ -29,6 +48,18 @@ import NoteService from "../../../../services/note" * type: boolean * description: Whether or not the Note 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/notes/get-note.ts b/packages/medusa/src/api/routes/admin/notes/get-note.ts index bbdc610411..4df52b5f9f 100644 --- a/packages/medusa/src/api/routes/admin/notes/get-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/get-note.ts @@ -8,6 +8,25 @@ import NoteService from "../../../../services/note" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the note to 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: @@ -19,6 +38,18 @@ import NoteService from "../../../../services/note" * properties: * note: * $ref: "#/components/schemas/note" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/notes/list-notes.ts b/packages/medusa/src/api/routes/admin/notes/list-notes.ts index 24990453be..92d8a0c9e3 100644 --- a/packages/medusa/src/api/routes/admin/notes/list-notes.ts +++ b/packages/medusa/src/api/routes/admin/notes/list-notes.ts @@ -15,6 +15,25 @@ import { validator } from "../../../../utils/validator" * - (query) limit=50 {number} The number of notes to get * - (query) offset=0 {number} The offset at which to get notes * - (query) resource_id {string} The ID which the notes belongs to + * 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: @@ -37,6 +56,18 @@ import { validator } from "../../../../utils/validator" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const validated = await validator(AdminGetNotesParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/notes/update-note.ts b/packages/medusa/src/api/routes/admin/notes/update-note.ts index c3f33379c0..12befc7937 100644 --- a/packages/medusa/src/api/routes/admin/notes/update-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/update-note.ts @@ -21,6 +21,31 @@ import { EntityManager } from "typeorm" * value: * type: string * description: The updated description of the Note. + * 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: @@ -32,7 +57,18 @@ import { EntityManager } from "typeorm" * properties: * note: * $ref: "#/components/schemas/note" - * + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts b/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts index c03cc3e378..b922fa779d 100644 --- a/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts +++ b/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts @@ -27,6 +27,25 @@ import { validator } from "../../../../utils/validator" * - (query) resource_id {string} The ID of the resource that the Notification refers to. * - (query) to {string} The address that the Notification was sent to. This will usually be an email address, but represent other addresses such as a chat bot user id * - (query) include_resends {string} A boolean indicating whether the result set should include resent notifications or not + * 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: @@ -40,6 +59,18 @@ import { validator } from "../../../../utils/validator" * type: array * items: * $ref: "#/components/schemas/notification" + * "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" */ export default async (req, res) => { const notificationService: NotificationService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts b/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts index 6cc8cf9f87..fb89235db3 100644 --- a/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts +++ b/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts @@ -26,6 +26,25 @@ import { validator } from "../../../../utils/validator" * to: * description: "A new address or user identifier that the Notification should be sent to" * 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.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: @@ -37,6 +56,18 @@ import { validator } from "../../../../utils/validator" * properties: * notification: * $ref: "#/components/schemas/notification" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts b/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts index e73da51d8f..4e42a8b22f 100644 --- a/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts +++ b/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts @@ -22,6 +22,33 @@ import { EntityManager } from "typeorm" * - (body) price=* {integer} The price (excluding VAT) that should be charged for the Shipping Method * - (body) option_id=* {string} The ID of the Shipping Option to create the Shipping Method from. * - (body) data {object} The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider. + * 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: @@ -33,6 +60,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/archive-order.ts b/packages/medusa/src/api/routes/admin/orders/archive-order.ts index 021e574bce..7070647323 100644 --- a/packages/medusa/src/api/routes/admin/orders/archive-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/archive-order.ts @@ -9,6 +9,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Order. + * 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: @@ -20,6 +39,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts b/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts index 87f6d278de..0c34e6ee8a 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts @@ -13,6 +13,25 @@ import { MedusaError } from "medusa-core-utils" * parameters: * - (path) id=* {string} The ID of the Order. * - (path) claim_id=* {string} The ID of the Claim. + * 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: @@ -24,6 +43,18 @@ import { MedusaError } from "medusa-core-utils" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, claim_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts index 437710121f..bd465d5fee 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts @@ -18,6 +18,25 @@ import { MedusaError } from "medusa-core-utils" * - (path) id=* {string} The ID of the Order which the Claim relates to. * - (path) claim_id=* {string} The ID of the Claim which the Fulfillment relates to. * - (path) fulfillment_id=* {string} The ID of the Fulfillment. + * 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: @@ -29,6 +48,18 @@ import { MedusaError } from "medusa-core-utils" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, claim_id, fulfillment_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts index 2b975a9d06..18d723943e 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts @@ -18,6 +18,25 @@ import { MedusaError } from "medusa-core-utils" * - (path) id=* {string} The ID of the Order which the Swap relates to. * - (path) swap_id=* {string} The ID of the Swap which the Fulfillment relates to. * - (path) fulfillment_id=* {string} The ID of the Fulfillment. + * 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: @@ -29,6 +48,18 @@ import { MedusaError } from "medusa-core-utils" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, swap_id, fulfillment_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts index 5e1e26e334..5f34a01f21 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts @@ -13,6 +13,25 @@ import { MedusaError } from "medusa-core-utils" * parameters: * - (path) id=* {string} The ID of the Order which the Fulfillment relates to. * - (path) fulfillment_id=* {string} The ID of the Fulfillment + * 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: @@ -24,6 +43,18 @@ import { MedusaError } from "medusa-core-utils" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, fulfillment_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-order.ts b/packages/medusa/src/api/routes/admin/orders/cancel-order.ts index 8f64ffda99..c60966521f 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-order.ts @@ -11,6 +11,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Order. + * 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: @@ -22,6 +41,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts b/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts index 97c1061313..4563dd90c4 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts @@ -13,6 +13,25 @@ import { MedusaError } from "medusa-core-utils" * parameters: * - (path) id=* {string} The ID of the Order. * - (path) swap_id=* {string} The ID of the Swap. + * 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: @@ -24,6 +43,18 @@ import { MedusaError } from "medusa-core-utils" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, swap_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/capture-payment.ts b/packages/medusa/src/api/routes/admin/orders/capture-payment.ts index ed4cf6d838..8678ce866d 100644 --- a/packages/medusa/src/api/routes/admin/orders/capture-payment.ts +++ b/packages/medusa/src/api/routes/admin/orders/capture-payment.ts @@ -11,6 +11,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Order. + * 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: @@ -22,6 +41,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/complete-order.ts b/packages/medusa/src/api/routes/admin/orders/complete-order.ts index 6e1fdb7555..e69d7e37f8 100644 --- a/packages/medusa/src/api/routes/admin/orders/complete-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/complete-order.ts @@ -9,6 +9,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Order. + * 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: @@ -20,6 +39,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts b/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts index 17901305fa..01e1854824 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts @@ -29,6 +29,31 @@ import { EntityManager } from "typeorm" * type: array * items: * 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.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: @@ -40,6 +65,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, claim_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/create-claim.ts b/packages/medusa/src/api/routes/admin/orders/create-claim.ts index 08e8c66bc8..f478364feb 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-claim.ts @@ -126,6 +126,43 @@ import { validator } from "../../../../utils/validator" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -137,6 +174,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts b/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts index 354be55bbc..f8e1965726 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts @@ -50,6 +50,41 @@ import { validator } from "../../../../utils/validator" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -61,6 +96,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/create-shipment.ts b/packages/medusa/src/api/routes/admin/orders/create-shipment.ts index 156ea81e0c..084e03e91a 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-shipment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-shipment.ts @@ -38,6 +38,31 @@ import { validator } from "../../../../utils/validator" * no_notification: * description: If set to true no notification will be send related to this Shipment. * type: boolean + * 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: @@ -49,6 +74,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts b/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts index 36fbc9e385..d2d4a95d62 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts @@ -38,6 +38,31 @@ import { validator } from "../../../../utils/validator" * no_notification: * description: If set to true no notification will be sent related to this Claim. * type: boolean + * 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: @@ -49,6 +74,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, swap_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/create-swap.ts b/packages/medusa/src/api/routes/admin/orders/create-swap.ts index b7878ec3cc..4a161c5e08 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-swap.ts @@ -105,6 +105,41 @@ import { validator } from "../../../../utils/validator" * description: If true, swaps can be completed with items out of stock * type: boolean * default: true + * 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: @@ -116,6 +151,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts b/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts index 9dbf5346bc..6995187cdd 100644 --- a/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts @@ -25,6 +25,25 @@ import { validator } from "../../../../utils/validator" * no_notification: * description: If set to true no notification will be send related to this Claim. * type: boolean + * 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: @@ -36,6 +55,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, claim_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts b/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts index cc4356ab9c..245e408d97 100644 --- a/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts @@ -25,6 +25,25 @@ import { validator } from "../../../../utils/validator" * no_notification: * description: If set to true no notification will be send related to this Claim. * type: boolean + * 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: @@ -36,6 +55,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, swap_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/get-order.ts b/packages/medusa/src/api/routes/admin/orders/get-order.ts index 9e88eb96d3..1444b6f872 100644 --- a/packages/medusa/src/api/routes/admin/orders/get-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/get-order.ts @@ -8,6 +8,25 @@ import { OrderService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Order. + * 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: @@ -19,6 +38,18 @@ import { OrderService } from "../../../../services" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/list-orders.ts b/packages/medusa/src/api/routes/admin/orders/list-orders.ts index 1be15dd8bd..22ecbfa0ee 100644 --- a/packages/medusa/src/api/routes/admin/orders/list-orders.ts +++ b/packages/medusa/src/api/routes/admin/orders/list-orders.ts @@ -153,6 +153,25 @@ import { pick } from "lodash" * - (query) limit=50 {integer} Limit the number of orders returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each order of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each order of the result. + * 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: @@ -175,6 +194,18 @@ import { pick } from "lodash" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const orderService: OrderService = req.scope.resolve("orderService") diff --git a/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts b/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts index d50a3c507d..aa383ef42a 100644 --- a/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts +++ b/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts @@ -12,6 +12,25 @@ import { EntityManager } from "typeorm" * parameters: * - (path) id=* {string} The ID of the Order. * - (path) swap_id=* {string} The ID of the Swap. + * 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: @@ -23,6 +42,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, swap_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/refund-payment.ts b/packages/medusa/src/api/routes/admin/orders/refund-payment.ts index 2faa47ef85..650c46db5d 100644 --- a/packages/medusa/src/api/routes/admin/orders/refund-payment.ts +++ b/packages/medusa/src/api/routes/admin/orders/refund-payment.ts @@ -39,6 +39,33 @@ import { EntityManager } from "typeorm" * no_notification: * description: If set to true no notification will be send related to this Refund. * type: boolean + * 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: @@ -50,6 +77,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/request-return.ts b/packages/medusa/src/api/routes/admin/orders/request-return.ts index 4fa67a96fc..bdb43e4b71 100644 --- a/packages/medusa/src/api/routes/admin/orders/request-return.ts +++ b/packages/medusa/src/api/routes/admin/orders/request-return.ts @@ -79,6 +79,41 @@ import { validator } from "../../../../utils/validator" * refund: * description: The amount to refund. * type: integer + * 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 @@ -91,6 +126,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/update-claim.ts b/packages/medusa/src/api/routes/admin/orders/update-claim.ts index cb176b095f..4b741eea98 100644 --- a/packages/medusa/src/api/routes/admin/orders/update-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/update-claim.ts @@ -105,6 +105,31 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object + * 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: @@ -116,6 +141,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id, claim_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/update-order.ts b/packages/medusa/src/api/routes/admin/orders/update-order.ts index 287e528043..ff013dc7e1 100644 --- a/packages/medusa/src/api/routes/admin/orders/update-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/update-order.ts @@ -90,6 +90,31 @@ import { validator } from "../../../../utils/validator" * no_notification: * description: A flag to indicate if no notifications should be emitted related to the updated order. * type: boolean + * 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: @@ -101,6 +126,18 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts b/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts index 43b17b8a4b..facfd03ade 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts @@ -56,6 +56,43 @@ import { EntityManager } from "typeorm" * override: * description: "If true the prices will replace all existing prices associated with the Price List." * type: boolean + * 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: @@ -67,6 +104,18 @@ import { EntityManager } from "typeorm" * properties: * price_list: * $ref: "#/components/schemas/price_list" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts index cca93408a9..94525eda00 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts @@ -98,6 +98,50 @@ import { Type } from "class-transformer" * id: * description: The ID of a customer group * type: string + * 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: @@ -109,6 +153,18 @@ import { Type } from "class-transformer" * properties: * price_list: * $ref: "#/components/schemas/price_list" + * "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" */ export default async (req: Request, res) => { const priceListService: PriceListService = diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts index 9862c36d1f..79702ae893 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts @@ -9,6 +9,25 @@ import PriceListService from "../../../../services/price-list" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Price List to 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: @@ -29,6 +48,18 @@ import PriceListService from "../../../../services/price-list" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts index 94dcc05ba4..084bb1cefb 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts @@ -22,6 +22,35 @@ import { validator } from "../../../../utils/validator" * type: array * items: * 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.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: @@ -44,6 +73,18 @@ import { validator } from "../../../../utils/validator" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts index fe52565131..f42df8dca6 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts @@ -10,6 +10,25 @@ import PriceListService from "../../../../services/price-list" * parameters: * - (path) id=* {string} The ID of the Price List that the Money Amounts that will be deleted belongs to. * - (path) product_id=* {string} The ID of the product from which the money amount will be deleted. + * 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: @@ -32,6 +51,18 @@ import PriceListService from "../../../../services/price-list" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { id, product_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts index f38457851e..0c7163533f 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts @@ -10,6 +10,25 @@ import PriceListService from "../../../../services/price-list" * parameters: * - (path) id=* {string} The ID of the Price List that the Money Amounts that will be deleted belongs to. * - (path) variant_id=* {string} The ID of the variant from which the money amount will be deleted. + * 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: @@ -32,6 +51,18 @@ import PriceListService from "../../../../services/price-list" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { id, variant_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts index 13fc214ca4..cece6f6a3b 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts @@ -11,6 +11,25 @@ import PriceListService from "../../../../services/price-list" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Price 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.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: @@ -22,6 +41,18 @@ import PriceListService from "../../../../services/price-list" * properties: * price_list: * $ref: "#/components/schemas/price_list" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts b/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts index adbafc4518..c00598ad77 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts @@ -133,6 +133,25 @@ import { isDefined } from "../../../../utils" * - (query) limit=50 {integer} Limit the number of products returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each product of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each product of the result. + * 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: * - Product * responses: @@ -155,6 +174,18 @@ import { isDefined } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts b/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts index 6653e086fd..8e575f2039 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts @@ -114,6 +114,25 @@ import { Type } from "class-transformer" * type: string * description: filter by dates greater than or equal to this date * format: date + * 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: @@ -136,6 +155,18 @@ import { Type } from "class-transformer" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res) => { const validated = req.validatedQuery diff --git a/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts index 6b53148151..9088be5edd 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts @@ -99,6 +99,31 @@ import { EntityManager } from "typeorm" * id: * description: The ID of a customer group * 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.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: @@ -110,6 +135,18 @@ import { EntityManager } from "typeorm" * properties: * price_list: * $ref: "#/components/schemas/price_list" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts b/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts index a4757cdf54..be3ff0460a 100644 --- a/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts +++ b/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts @@ -92,6 +92,25 @@ import { isDefined } from "../../../../utils" * type: string * description: filter by dates greater than or equal to this date * format: date + * 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: @@ -112,6 +131,18 @@ import { isDefined } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const validated = await validator(AdminGetProductTagsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts b/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts index 84f6e69fbd..fdc9ae4955 100644 --- a/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts +++ b/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts @@ -92,6 +92,25 @@ import { isDefined } from "../../../../utils" * type: string * description: filter by dates greater than or equal to this date * format: date + * 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: @@ -112,6 +131,18 @@ import { isDefined } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const validated = await validator(AdminGetProductTypesParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/products/add-option.ts b/packages/medusa/src/api/routes/admin/products/add-option.ts index 3fa80b9020..257a61ad80 100644 --- a/packages/medusa/src/api/routes/admin/products/add-option.ts +++ b/packages/medusa/src/api/routes/admin/products/add-option.ts @@ -23,6 +23,31 @@ import { EntityManager } from "typeorm" * title: * description: "The title the Product Option will be identified by i.e. \"Size\"" * 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.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: @@ -34,6 +59,18 @@ import { EntityManager } from "typeorm" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/create-product.ts b/packages/medusa/src/api/routes/admin/products/create-product.ts index 539e6653c3..a9c4f48996 100644 --- a/packages/medusa/src/api/routes/admin/products/create-product.ts +++ b/packages/medusa/src/api/routes/admin/products/create-product.ts @@ -245,6 +245,33 @@ import { validator } from "../../../../utils/validator" * metadata: * description: An optional set of key-value pairs with additional information. * type: object + * 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: @@ -256,6 +283,18 @@ import { validator } from "../../../../utils/validator" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostProductsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/products/create-variant.ts b/packages/medusa/src/api/routes/admin/products/create-variant.ts index 5e4958ab3f..faa276dbc2 100644 --- a/packages/medusa/src/api/routes/admin/products/create-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/create-variant.ts @@ -124,6 +124,56 @@ import { EntityManager } from "typeorm" * value: * description: The value to give for the Product Option. * 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.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: @@ -135,6 +185,18 @@ import { EntityManager } from "typeorm" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/delete-option.ts b/packages/medusa/src/api/routes/admin/products/delete-option.ts index e5e7909dc2..13b2cde77e 100644 --- a/packages/medusa/src/api/routes/admin/products/delete-option.ts +++ b/packages/medusa/src/api/routes/admin/products/delete-option.ts @@ -12,6 +12,25 @@ import { ProductService } from "../../../../services" * parameters: * - (path) id=* {string} The ID of the Product. * - (path) option_id=* {string} The ID of the Product Option. + * 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: @@ -34,6 +53,18 @@ import { ProductService } from "../../../../services" * default: true * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id, option_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/delete-product.ts b/packages/medusa/src/api/routes/admin/products/delete-product.ts index f8955a7067..2b83ba4ef9 100644 --- a/packages/medusa/src/api/routes/admin/products/delete-product.ts +++ b/packages/medusa/src/api/routes/admin/products/delete-product.ts @@ -9,6 +9,25 @@ import { ProductService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Product. + * 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: @@ -29,6 +48,18 @@ import { ProductService } from "../../../../services" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/delete-variant.ts b/packages/medusa/src/api/routes/admin/products/delete-variant.ts index ecf09a932f..e3bde0c880 100644 --- a/packages/medusa/src/api/routes/admin/products/delete-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/delete-variant.ts @@ -16,6 +16,25 @@ import { EntityManager } from "typeorm" * parameters: * - (path) id=* {string} The ID of the Product. * - (path) variant_id=* {string} The ID of the Product Variant. + * 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: @@ -38,6 +57,18 @@ import { EntityManager } from "typeorm" * default: true * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id, variant_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/get-product.ts b/packages/medusa/src/api/routes/admin/products/get-product.ts index 5ebb548054..f4ac30e6cb 100644 --- a/packages/medusa/src/api/routes/admin/products/get-product.ts +++ b/packages/medusa/src/api/routes/admin/products/get-product.ts @@ -8,6 +8,25 @@ import { PricingService, ProductService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Product. + * 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: @@ -19,6 +38,18 @@ import { PricingService, ProductService } from "../../../../services" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/list-products.ts b/packages/medusa/src/api/routes/admin/products/list-products.ts index 5e2a2fe2be..c71e6a1e2b 100644 --- a/packages/medusa/src/api/routes/admin/products/list-products.ts +++ b/packages/medusa/src/api/routes/admin/products/list-products.ts @@ -148,6 +148,25 @@ import { Type } from "class-transformer" * - (query) limit=50 {integer} Limit the number of products returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each product of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each product of the result. + * 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: @@ -170,6 +189,18 @@ import { Type } from "class-transformer" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const productService: ProductService = req.scope.resolve("productService") diff --git a/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts b/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts index 3bd5ee597e..3c70f8a212 100644 --- a/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts +++ b/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts @@ -6,6 +6,25 @@ import { ProductService } from "../../../../services" * summary: "List Product Tags Usage Number" * description: "Retrieves a list of Product Tags with how many times each is used." * x-authenticated: true + * 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: @@ -28,6 +47,18 @@ import { ProductService } from "../../../../services" * value: * description: The value of the tag. * type: string + * "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" */ export default async (req, res) => { const productService: ProductService = req.scope.resolve("productService") diff --git a/packages/medusa/src/api/routes/admin/products/list-types.ts b/packages/medusa/src/api/routes/admin/products/list-types.ts index 301858b4ef..f2b0f026b3 100644 --- a/packages/medusa/src/api/routes/admin/products/list-types.ts +++ b/packages/medusa/src/api/routes/admin/products/list-types.ts @@ -6,6 +6,25 @@ import { ProductService } from "../../../../services" * summary: "List Product Types" * description: "Retrieves a list of Product Types." * x-authenticated: true + * 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: @@ -19,6 +38,18 @@ import { ProductService } from "../../../../services" * type: array * items: * $ref: "#/components/schemas/product_type" + * "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" */ export default async (req, res) => { const productService: ProductService = req.scope.resolve("productService") diff --git a/packages/medusa/src/api/routes/admin/products/list-variants.ts b/packages/medusa/src/api/routes/admin/products/list-variants.ts index b5972c6e35..a3a22ed26b 100644 --- a/packages/medusa/src/api/routes/admin/products/list-variants.ts +++ b/packages/medusa/src/api/routes/admin/products/list-variants.ts @@ -20,6 +20,15 @@ import { validator } from "../../../../utils/validator" * - (query) expand {string} Comma separated string of the relations to include. * - (query) offset=0 {integer} How many items to skip before the results. * - (query) limit=100 {integer} Limit the number of items returned. + * 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: @@ -42,6 +51,18 @@ import { validator } from "../../../../utils/validator" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/set-metadata.ts b/packages/medusa/src/api/routes/admin/products/set-metadata.ts index 909784962c..b3eaac5fb0 100644 --- a/packages/medusa/src/api/routes/admin/products/set-metadata.ts +++ b/packages/medusa/src/api/routes/admin/products/set-metadata.ts @@ -26,6 +26,33 @@ import { EntityManager } from "typeorm" * value: * description: The metadata value * 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.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: @@ -37,6 +64,18 @@ import { EntityManager } from "typeorm" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/update-option.ts b/packages/medusa/src/api/routes/admin/products/update-option.ts index 9883b9351d..b9a293f6b0 100644 --- a/packages/medusa/src/api/routes/admin/products/update-option.ts +++ b/packages/medusa/src/api/routes/admin/products/update-option.ts @@ -24,6 +24,31 @@ import { EntityManager } from "typeorm" * title: * description: "The title of the Product Option" * 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.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: @@ -35,6 +60,18 @@ import { EntityManager } from "typeorm" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id, option_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/update-product.ts b/packages/medusa/src/api/routes/admin/products/update-product.ts index 680bf58f75..f6d1c14f5a 100644 --- a/packages/medusa/src/api/routes/admin/products/update-product.ts +++ b/packages/medusa/src/api/routes/admin/products/update-product.ts @@ -228,6 +228,32 @@ import { validator } from "../../../../utils/validator" * metadata: * description: An optional set of key-value pairs with additional information. * type: object + * 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: @@ -239,6 +265,18 @@ import { validator } from "../../../../utils/validator" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/update-variant.ts b/packages/medusa/src/api/routes/admin/products/update-variant.ts index aa9842f6a6..aec9018fff 100644 --- a/packages/medusa/src/api/routes/admin/products/update-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/update-variant.ts @@ -33,6 +33,8 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: + * required: + * - prices * properties: * title: * description: The title to identify the Product Variant by. @@ -125,6 +127,50 @@ import { EntityManager } from "typeorm" * value: * description: The value to give for the Product Option. * 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.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: @@ -136,6 +182,18 @@ import { EntityManager } from "typeorm" * properties: * product: * $ref: "#/components/schemas/product" + * "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" */ export default async (req, res) => { const { id, variant_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/add-country.ts b/packages/medusa/src/api/routes/admin/regions/add-country.ts index 33ca5610f6..2c797b9dee 100644 --- a/packages/medusa/src/api/routes/admin/regions/add-country.ts +++ b/packages/medusa/src/api/routes/admin/regions/add-country.ts @@ -27,6 +27,31 @@ import { validator } from "../../../../utils/validator" * externalDocs: * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements * description: See a list of codes. + * 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: @@ -38,6 +63,18 @@ import { validator } from "../../../../utils/validator" * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts b/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts index 29b6fa76ef..bab882cd2f 100644 --- a/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts @@ -24,6 +24,31 @@ import { validator } from "../../../../utils/validator" * provider_id: * description: "The ID of the Fulfillment Provider to add." * 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.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: @@ -35,6 +60,18 @@ import { validator } from "../../../../utils/validator" * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts b/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts index 8cb05a6b26..72cd656a0c 100644 --- a/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts @@ -24,6 +24,31 @@ import { validator } from "../../../../utils/validator" * provider_id: * description: "The ID of the Payment Provider to add." * 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.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: @@ -35,6 +60,18 @@ import { validator } from "../../../../utils/validator" * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/create-region.ts b/packages/medusa/src/api/routes/admin/regions/create-region.ts index 6027d52209..e62737c172 100644 --- a/packages/medusa/src/api/routes/admin/regions/create-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/create-region.ts @@ -61,6 +61,53 @@ import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." * type: array * items: * 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.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: @@ -72,6 +119,18 @@ import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostRegionsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/regions/delete-region.ts b/packages/medusa/src/api/routes/admin/regions/delete-region.ts index 54629ca7c9..ec6715c642 100644 --- a/packages/medusa/src/api/routes/admin/regions/delete-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/delete-region.ts @@ -9,6 +9,25 @@ import RegionService from "../../../../services/region" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Region. + * 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: @@ -29,6 +48,18 @@ import RegionService from "../../../../services/region" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts b/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts index aef8f97159..0061941f06 100644 --- a/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts +++ b/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts @@ -10,6 +10,25 @@ import RegionService from "../../../../services/region" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Region. + * 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: @@ -33,6 +52,18 @@ import RegionService from "../../../../services/region" * - id: "manual-fulfillment" * - id: "manual-fulfillment-return" * is_return: 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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/get-region.ts b/packages/medusa/src/api/routes/admin/regions/get-region.ts index 96af4b1322..e52aa5234c 100644 --- a/packages/medusa/src/api/routes/admin/regions/get-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/get-region.ts @@ -10,6 +10,25 @@ import RegionService from "../../../../services/region" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Region. + * 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: @@ -21,6 +40,18 @@ import RegionService from "../../../../services/region" * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/list-regions.ts b/packages/medusa/src/api/routes/admin/regions/list-regions.ts index 846e788236..816a396fe4 100644 --- a/packages/medusa/src/api/routes/admin/regions/list-regions.ts +++ b/packages/medusa/src/api/routes/admin/regions/list-regions.ts @@ -47,6 +47,25 @@ import { validator } from "../../../../utils/validator" * type: object * required: false * description: Date comparison for when resulting region was deleted, i.e. less than, greater than etc. + * 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: @@ -69,6 +88,18 @@ import { validator } from "../../../../utils/validator" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const validated = await validator(AdminGetRegionsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/regions/remove-country.ts b/packages/medusa/src/api/routes/admin/regions/remove-country.ts index 42bc3ecc31..820fb3df99 100644 --- a/packages/medusa/src/api/routes/admin/regions/remove-country.ts +++ b/packages/medusa/src/api/routes/admin/regions/remove-country.ts @@ -20,6 +20,25 @@ import RegionService from "../../../../services/region" * externalDocs: * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes * description: See a list of codes. + * 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: @@ -31,6 +50,18 @@ import RegionService from "../../../../services/region" * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id, country_code } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts b/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts index 96e778bbf9..458c7928a3 100644 --- a/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts @@ -12,6 +12,25 @@ import RegionService from "../../../../services/region" * parameters: * - (path) id=* {string} The ID of the Region. * - (path) provider_id=* {string} The ID of the Fulfillment Provider. + * 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: @@ -23,6 +42,18 @@ import RegionService from "../../../../services/region" * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id, provider_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts b/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts index 7faed2b11b..04841566a6 100644 --- a/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts @@ -12,6 +12,25 @@ import RegionService from "../../../../services/region" * parameters: * - (path) id=* {string} The ID of the Region. * - (path) provider_id=* {string} The ID of the Payment Provider. + * 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: @@ -23,6 +42,18 @@ import RegionService from "../../../../services/region" * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id, provider_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/update-region.ts b/packages/medusa/src/api/routes/admin/regions/update-region.ts index 7cbce73dfe..5a2189a678 100644 --- a/packages/medusa/src/api/routes/admin/regions/update-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/update-region.ts @@ -64,6 +64,31 @@ import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." * type: array * items: * 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.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: @@ -75,6 +100,18 @@ import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." * properties: * region: * $ref: "#/components/schemas/region" + * "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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts index c23c7b2f6c..343a7a78c6 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts @@ -37,6 +37,33 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs with additional information. * type: object + * 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: @@ -48,6 +75,18 @@ import { EntityManager } from "typeorm" * properties: * return_reason: * $ref: "#/components/schemas/return_reason" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostReturnReasonsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts index e8d17aab9c..c27b7677f4 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts @@ -9,6 +9,25 @@ import { ReturnReasonService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the return reason + * 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: @@ -29,6 +48,18 @@ import { ReturnReasonService } from "../../../../services" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts index 260b967b78..581ca1cbc0 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts @@ -13,6 +13,25 @@ import { ReturnReasonService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Return Reason. + * 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: @@ -24,6 +43,18 @@ import { ReturnReasonService } from "../../../../services" * properties: * return_reason: * $ref: "#/components/schemas/return_reason" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/return-reasons/list-reasons.ts b/packages/medusa/src/api/routes/admin/return-reasons/list-reasons.ts index 861e387370..afea7d1e0f 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/list-reasons.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/list-reasons.ts @@ -12,6 +12,25 @@ import { FindConfig, Selector } from "../../../../types/common" * summary: "List Return Reasons" * description: "Retrieves a list of Return Reasons." * x-authenticated: true + * 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: @@ -25,6 +44,18 @@ import { FindConfig, Selector } from "../../../../types/common" * type: array * items: * $ref: "#/components/schemas/return_reason" + * "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" */ export default async (req, res) => { const returnReasonService: ReturnReasonService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts index 71df342bde..4b7094b95f 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts @@ -33,6 +33,31 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs with additional information. * type: object + * 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: @@ -44,6 +69,18 @@ import { EntityManager } from "typeorm" * properties: * return_reason: * $ref: "#/components/schemas/return_reason" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/returns/cancel-return.ts b/packages/medusa/src/api/routes/admin/returns/cancel-return.ts index 38d6d2ad08..7096d5246f 100644 --- a/packages/medusa/src/api/routes/admin/returns/cancel-return.ts +++ b/packages/medusa/src/api/routes/admin/returns/cancel-return.ts @@ -12,6 +12,25 @@ import { EntityManager } from "typeorm" * description: "Registers a Return as canceled." * parameters: * - (path) id=* {string} The ID of the Return. + * 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: @@ -23,6 +42,18 @@ import { EntityManager } from "typeorm" * properties: * order: * $ref: "#/components/schemas/order" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/returns/list-returns.ts b/packages/medusa/src/api/routes/admin/returns/list-returns.ts index 3f0d3124ab..491ab656fc 100644 --- a/packages/medusa/src/api/routes/admin/returns/list-returns.ts +++ b/packages/medusa/src/api/routes/admin/returns/list-returns.ts @@ -14,6 +14,25 @@ import { Return } from "../../../../models" * parameters: * - (query) limit=50 {number} The upper limit for the amount of responses returned. * - (query) offset=0 {number} The offset of the list returned. + * 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: @@ -36,6 +55,18 @@ import { Return } from "../../../../models" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const returnService: ReturnService = req.scope.resolve("returnService") diff --git a/packages/medusa/src/api/routes/admin/returns/receive-return.ts b/packages/medusa/src/api/routes/admin/returns/receive-return.ts index c804a95460..9a9b1690a3 100644 --- a/packages/medusa/src/api/routes/admin/returns/receive-return.ts +++ b/packages/medusa/src/api/routes/admin/returns/receive-return.ts @@ -43,6 +43,41 @@ import { isDefined } from "../../../../utils" * refund: * description: The amount to refund. * type: number + * 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(({ return }) => { + * console.log(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: @@ -54,6 +89,18 @@ import { isDefined } from "../../../../utils" * properties: * return: * $ref: "#/components/schemas/return" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts b/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts index f5dc460358..98a6fea8c4 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts @@ -32,6 +32,39 @@ import { Type } from "class-transformer" * id: * type: string * description: The ID of the product + * 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: @@ -43,6 +76,18 @@ import { Type } from "class-transformer" * properties: * sales_channel: * $ref: "#/components/schemas/sales_channel" + * "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" */ export default async (req: Request, res: Response): Promise => { const validatedBody = diff --git a/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts index 66254dfc1e..36af725475 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts @@ -27,6 +27,32 @@ import SalesChannelService from "../../../../services/sales-channel" * is_disabled: * description: Whether the Sales Channel is disabled or not. * type: boolean + * 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: @@ -38,6 +64,18 @@ import SalesChannelService from "../../../../services/sales-channel" * properties: * sales_channel: * $ref: "#/components/schemas/sales_channel" + * "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" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts b/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts index c41b5ed022..d7983c2710 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts @@ -32,6 +32,39 @@ import { Type } from "class-transformer" * id: * description: The ID of a product * 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.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: @@ -43,6 +76,18 @@ import { Type } from "class-transformer" * properties: * sales_channel: * $ref: "#/components/schemas/sales_channel" + * "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" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts index 838a9e098d..c11aed6442 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts @@ -11,6 +11,25 @@ import { SalesChannelService } from "../../../../services/" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Sales channel. + * 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: @@ -31,6 +50,18 @@ import { SalesChannelService } from "../../../../services/" * type: boolean * description: Whether or not the items were 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" */ export default async (req: Request, res: Response): Promise => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts index f9819c31be..d5511740e9 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts @@ -10,6 +10,25 @@ import { SalesChannelService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Sales channel. + * 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: @@ -21,6 +40,18 @@ import { SalesChannelService } from "../../../../services" * properties: * sales_channel: * $ref: "#/components/schemas/sales_channel" + * "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" */ export default async (req: Request, res: Response): Promise => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts b/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts index b064bb4d02..f1aa54f16f 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts @@ -91,6 +91,25 @@ import { removeUndefinedProperties } from "../../../../utils" * - (query) limit=20 {integer} Limit the number of sales channels returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each sales channel of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each sales channel of the result. + * 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: @@ -113,6 +132,18 @@ import { removeUndefinedProperties } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res: Response) => { const salesChannelService: SalesChannelService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts index 502a38c9e9..b924922596 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts @@ -26,6 +26,31 @@ import { EntityManager } from "typeorm" * is_disabled: * type: boolean * description: Indication of if the sales channel is active. + * 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: @@ -37,6 +62,18 @@ import { EntityManager } from "typeorm" * properties: * sales_channel: * $ref: "#/components/schemas/sales_channel" + * "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" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts index 347c810712..ee617d8800 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts @@ -81,6 +81,40 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs with additional information. * type: object + * 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: @@ -92,6 +126,18 @@ import { EntityManager } from "typeorm" * properties: * shipping_option: * $ref: "#/components/schemas/shipping_option" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostShippingOptionsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts index 97325577ae..a7a05631d4 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts @@ -8,6 +8,25 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Shipping Option. + * 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: @@ -28,6 +47,18 @@ import { EntityManager } from "typeorm" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { option_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts index 6406c11a19..6716f38987 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts @@ -6,6 +6,25 @@ * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Shipping Option. + * 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: @@ -17,6 +36,18 @@ * properties: * shipping_option: * $ref: "#/components/schemas/shipping_option" + * "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" */ export default async (req, res) => { const { option_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts b/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts index b7662973ab..f773c3e728 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts @@ -28,6 +28,25 @@ import { validator } from "../../../../utils/validator" * schema: * type: boolean * description: Flag for fetching admin specific options + * 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: @@ -44,6 +63,18 @@ import { validator } from "../../../../utils/validator" * count: * type: integer * description: The total number of items available + * "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" */ export default async (req, res) => { const validatedParams = await validator( diff --git a/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts index a4f3286f74..2c7f235d11 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts @@ -60,6 +60,43 @@ import { EntityManager } from "typeorm" * amount: * description: The amount to compare with. * type: integer + * 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: @@ -71,6 +108,18 @@ import { EntityManager } from "typeorm" * properties: * shipping_option: * $ref: "#/components/schemas/shipping_option" + * "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" */ export default async (req, res) => { const { option_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/create-shipping-profile.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/create-shipping-profile.ts index cd9778a584..ca224ba78f 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/create-shipping-profile.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/create-shipping-profile.ts @@ -19,6 +19,31 @@ import { EntityManager } from "typeorm" * name: * description: "The name of the Shipping Profile" * 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.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: @@ -30,6 +55,18 @@ import { EntityManager } from "typeorm" * properties: * shipping_profile: * $ref: "#/components/schemas/shipping_profile" + * "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" */ export default async (req, res) => { const validated = await validator(AdminPostShippingProfilesReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts index 96547d7d06..1c2b58da25 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts @@ -9,6 +9,25 @@ import { ShippingProfileService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Shipping Profile. + * 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: @@ -29,6 +48,18 @@ import { ShippingProfileService } from "../../../../services" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { profile_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts index 3da47c61e3..2220695c10 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts @@ -13,6 +13,25 @@ import { ShippingProfileService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Shipping Profile. + * 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: @@ -24,6 +43,18 @@ import { ShippingProfileService } from "../../../../services" * properties: * shipping_profile: * $ref: "#/components/schemas/shipping_profile" + * "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" */ export default async (req, res) => { const { profile_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/list-shipping-profiles.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/list-shipping-profiles.ts index a0306b6eb6..76f44b0e3f 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/list-shipping-profiles.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/list-shipping-profiles.ts @@ -6,6 +6,25 @@ import { ShippingProfileService } from "../../../../services" * summary: "List Shipping Profiles" * description: "Retrieves a list of Shipping Profile." * x-authenticated: true + * 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: @@ -19,6 +38,18 @@ import { ShippingProfileService } from "../../../../services" * type: array * items: * $ref: "#/components/schemas/shipping_profile" + * "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" */ export default async (req, res) => { const profileService: ShippingProfileService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts index 885542d1af..5410fad46b 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts @@ -19,6 +19,31 @@ import { EntityManager } from "typeorm" * name: * description: "The name of the Shipping Profile" * 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.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: @@ -30,6 +55,18 @@ import { EntityManager } from "typeorm" * properties: * shipping_profile: * $ref: "#/components/schemas/shipping_profile" + * "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" */ export default async (req, res) => { const { profile_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/store/add-currency.ts b/packages/medusa/src/api/routes/admin/store/add-currency.ts index 7bc0b81245..70a8732bcd 100644 --- a/packages/medusa/src/api/routes/admin/store/add-currency.ts +++ b/packages/medusa/src/api/routes/admin/store/add-currency.ts @@ -16,6 +16,25 @@ import { EntityManager } from "typeorm" * externalDocs: * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes * description: See a list of codes. + * 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: @@ -27,6 +46,18 @@ import { EntityManager } from "typeorm" * properties: * store: * $ref: "#/components/schemas/store" + * "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" */ export default async (req, res) => { const { currency_code } = req.params diff --git a/packages/medusa/src/api/routes/admin/store/get-store.ts b/packages/medusa/src/api/routes/admin/store/get-store.ts index 22b3b5c870..c448b1d84d 100644 --- a/packages/medusa/src/api/routes/admin/store/get-store.ts +++ b/packages/medusa/src/api/routes/admin/store/get-store.ts @@ -13,6 +13,25 @@ import { FlagRouter } from "../../../../utils/flag-router" * summary: "Retrieve Store details." * description: "Retrieves the Store details" * x-authenticated: true + * 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: @@ -24,6 +43,18 @@ import { FlagRouter } from "../../../../utils/flag-router" * properties: * store: * $ref: "#/components/schemas/store" + * "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" */ export default async (req, res) => { const storeService: StoreService = req.scope.resolve("storeService") diff --git a/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts b/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts index 7c1ad38c7b..51a036848b 100644 --- a/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts +++ b/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts @@ -5,6 +5,25 @@ import { PaymentProviderService } from "../../../../services" * summary: "Retrieve configured Payment Providers" * description: "Retrieves the configured Payment Providers" * x-authenticated: true + * 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: @@ -18,6 +37,18 @@ import { PaymentProviderService } from "../../../../services" * type: array * items: * $ref: "#/components/schemas/payment_provider" + * "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" */ export default async (req, res) => { const paymentProviderService: PaymentProviderService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts b/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts index af67f97b57..77223ad10b 100644 --- a/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts +++ b/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts @@ -6,6 +6,25 @@ import { TaxProviderService } from "../../../../services" * summary: "Retrieve configured Tax Providers" * description: "Retrieves the configured Tax Providers" * x-authenticated: true + * 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: @@ -19,6 +38,18 @@ import { TaxProviderService } from "../../../../services" * type: array * items: * $ref: "#/components/schemas/tax_provider" + * "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" */ export default async (req, res) => { const taxProviderService: TaxProviderService = diff --git a/packages/medusa/src/api/routes/admin/store/remove-currency.ts b/packages/medusa/src/api/routes/admin/store/remove-currency.ts index 6a038f29d9..3e0aa55763 100644 --- a/packages/medusa/src/api/routes/admin/store/remove-currency.ts +++ b/packages/medusa/src/api/routes/admin/store/remove-currency.ts @@ -17,6 +17,25 @@ import { EntityManager } from "typeorm" * externalDocs: * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes * description: See a list of codes. + * 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: @@ -28,6 +47,18 @@ import { EntityManager } from "typeorm" * properties: * store: * $ref: "#/components/schemas/store" + * "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" */ export default async (req, res) => { const { currency_code } = req.params diff --git a/packages/medusa/src/api/routes/admin/store/update-store.ts b/packages/medusa/src/api/routes/admin/store/update-store.ts index aa45888932..87b975c2d3 100644 --- a/packages/medusa/src/api/routes/admin/store/update-store.ts +++ b/packages/medusa/src/api/routes/admin/store/update-store.ts @@ -41,6 +41,31 @@ import { EntityManager } from "typeorm" * metadata: * description: "An optional set of key-value pairs with additional information." * type: object + * 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: @@ -52,6 +77,18 @@ import { EntityManager } from "typeorm" * properties: * store: * $ref: "#/components/schemas/store" + * "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" */ export default async (req, res) => { const validatedBody = await validator(AdminPostStoreReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/swaps/get-swap.ts b/packages/medusa/src/api/routes/admin/swaps/get-swap.ts index d341c44e57..f07f007ff5 100644 --- a/packages/medusa/src/api/routes/admin/swaps/get-swap.ts +++ b/packages/medusa/src/api/routes/admin/swaps/get-swap.ts @@ -10,6 +10,25 @@ import { SwapService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Swap. + * 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: @@ -21,6 +40,18 @@ import { SwapService } from "../../../../services" * properties: * swap: * $ref: "#/components/schemas/swap" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts b/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts index b19ed51361..ddc976f0cb 100644 --- a/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts +++ b/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts @@ -15,6 +15,25 @@ import { Swap } from "../../../../models" * - (query) limit=50 {number} The upper limit for the amount of responses returned. * - (query) offset=0 {number} The offset of the list returned. * x-authenticated: true + * 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: @@ -37,6 +56,18 @@ import { Swap } from "../../../../models" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const swapService: SwapService = req.scope.resolve("swapService") diff --git a/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts b/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts index 0721ceca4c..6679550469 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts @@ -44,6 +44,35 @@ import { validator } from "../../../../utils/validator" * description: "The IDs of the types of products to associate with this tax rate" * items: * 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.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: @@ -55,6 +84,18 @@ import { validator } from "../../../../utils/validator" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts b/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts index cc589dbc58..c8b7a0016a 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts @@ -44,6 +44,35 @@ import { validator } from "../../../../utils/validator" * description: "The IDs of the products to associate with this tax rate" * items: * 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.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: @@ -55,6 +84,18 @@ import { validator } from "../../../../utils/validator" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator(AdminPostTaxRatesTaxRateProductsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts b/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts index b12a722b27..fac7d76315 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts @@ -44,6 +44,35 @@ import { validator } from "../../../../utils/validator" * description: "The IDs of the shipping options to associate with this tax rate" * items: * 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.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: @@ -55,6 +84,18 @@ import { validator } from "../../../../utils/validator" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts index 6ad7a5fb74..a8dcc404fc 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts @@ -71,6 +71,35 @@ import { isDefined } from "../../../../utils" * description: "The IDs of the types of products associated with this tax rate" * items: * 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.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: @@ -82,6 +111,18 @@ import { isDefined } from "../../../../utils" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator(AdminPostTaxRatesReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts index f97a1fad9f..789101f7d3 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts @@ -9,6 +9,25 @@ import { TaxRateService } from "../../../../services" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Shipping Option. + * 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: @@ -29,6 +48,18 @@ import { TaxRateService } from "../../../../services" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts index ff42468538..747220a3c4 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts @@ -31,6 +31,25 @@ import { validator } from "../../../../utils/validator" * items: * type: string * x-authenticated: true + * 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: @@ -42,6 +61,18 @@ import { validator } from "../../../../utils/validator" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator(AdminGetTaxRatesTaxRateParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts b/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts index c50e9e2fcc..12272726f9 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts @@ -71,6 +71,25 @@ import { validator } from "../../../../utils/validator" * type: array * items: * 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.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: @@ -93,6 +112,18 @@ import { validator } from "../../../../utils/validator" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const value = await validator(AdminGetTaxRatesParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts index 83ec2c5b79..e146d3ff46 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts @@ -44,6 +44,35 @@ import { validator } from "../../../../utils/validator" * description: "The IDs of the types of products to remove association with this tax rate" * items: * 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.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: @@ -55,6 +84,18 @@ import { validator } from "../../../../utils/validator" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts index a32c292909..430b80db5f 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts @@ -44,6 +44,35 @@ import { validator } from "../../../../utils/validator" * description: "The IDs of the products to remove association with this tax rate" * items: * 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.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: @@ -55,6 +84,18 @@ import { validator } from "../../../../utils/validator" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator(AdminDeleteTaxRatesTaxRateProductsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts index 74f773f58b..0e8845e4c8 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts @@ -44,6 +44,35 @@ import { validator } from "../../../../utils/validator" * description: "The IDs of the shipping options to remove association with this tax rate" * items: * 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.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: @@ -55,6 +84,18 @@ import { validator } from "../../../../utils/validator" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts index 5121835a6c..1413cdf4ca 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts @@ -67,6 +67,31 @@ import { isDefined } from "../../../../utils" * description: "The IDs of the types of products associated with this tax rate" * items: * 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.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: @@ -78,6 +103,18 @@ import { isDefined } from "../../../../utils" * properties: * tax_rate: * $ref: "#/components/schemas/tax_rate" + * "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" */ export default async (req, res) => { const value = await validator(AdminPostTaxRatesTaxRateReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/uploads/create-upload.ts b/packages/medusa/src/api/routes/admin/uploads/create-upload.ts index 174bf2bff4..7e93d532db 100644 --- a/packages/medusa/src/api/routes/admin/uploads/create-upload.ts +++ b/packages/medusa/src/api/routes/admin/uploads/create-upload.ts @@ -6,8 +6,6 @@ import fs from "fs" * summary: "Uploads a file" * description: "Uploads a file to the specific fileservice that is installed in Medusa." * x-authenticated: true - * tags: - * - Upload * requestBody: * content: * multipart/form-data: @@ -17,6 +15,29 @@ import fs from "fs" * 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' \ + * --data-binary '{file_path}' + * security: + * - api_token: [] + * - cookie_auth: [] + * tags: + * - Upload * responses: * 200: * description: OK @@ -33,6 +54,18 @@ import fs from "fs" * type: string * description: The URL of the uploaded file. * format: uri + * "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" */ export default async (req, res) => { try { diff --git a/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts b/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts index 0affea868a..b5551fdedc 100644 --- a/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts +++ b/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts @@ -16,6 +16,31 @@ import { IsString } from "class-validator" * file_key: * description: "key of the file to delete" * 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.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: @@ -36,6 +61,18 @@ import { IsString } from "class-validator" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const validated = req.validatedBody as AdminDeleteUploadsReq diff --git a/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts b/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts index db264e85b1..16298e0975 100644 --- a/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts +++ b/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts @@ -17,6 +17,31 @@ import { IsString } from "class-validator" * file_key: * description: "key of the file to obtain the download link for" * 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.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: @@ -29,6 +54,18 @@ import { IsString } from "class-validator" * download_url: * type: string * description: The Download URL of the file + * "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" */ export default async (req, res) => { const fileService: AbstractFileService = req.scope.resolve("fileService") diff --git a/packages/medusa/src/api/routes/admin/users/create-user.ts b/packages/medusa/src/api/routes/admin/users/create-user.ts index 1ed8d7e202..0c6b3b6d21 100644 --- a/packages/medusa/src/api/routes/admin/users/create-user.ts +++ b/packages/medusa/src/api/routes/admin/users/create-user.ts @@ -38,6 +38,33 @@ import { EntityManager } from "typeorm" * description: "The Users password." * type: string * format: password + * 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: @@ -49,6 +76,18 @@ import { EntityManager } from "typeorm" * properties: * user: * $ref: "#/components/schemas/user" + * "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" */ export default async (req, res) => { const validated = await validator(AdminCreateUserRequest, req.body) diff --git a/packages/medusa/src/api/routes/admin/users/delete-user.ts b/packages/medusa/src/api/routes/admin/users/delete-user.ts index a68ca5fe67..525451371c 100644 --- a/packages/medusa/src/api/routes/admin/users/delete-user.ts +++ b/packages/medusa/src/api/routes/admin/users/delete-user.ts @@ -9,6 +9,25 @@ import UserService from "../../../../services/user" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the User. + * 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: * - Users * responses: @@ -29,6 +48,18 @@ import UserService from "../../../../services/user" * type: boolean * description: Whether or not the items were 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" */ export default async (req, res) => { const { user_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/users/get-user.ts b/packages/medusa/src/api/routes/admin/users/get-user.ts index cddebaca94..b14b662fda 100644 --- a/packages/medusa/src/api/routes/admin/users/get-user.ts +++ b/packages/medusa/src/api/routes/admin/users/get-user.ts @@ -8,6 +8,25 @@ import UserService from "../../../../services/user" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the User. + * 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: @@ -19,6 +38,18 @@ import UserService from "../../../../services/user" * properties: * user: * $ref: "#/components/schemas/user" + * "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" */ export default async (req, res) => { const { user_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/users/list-users.ts b/packages/medusa/src/api/routes/admin/users/list-users.ts index 3e142a156a..80c653fffa 100644 --- a/packages/medusa/src/api/routes/admin/users/list-users.ts +++ b/packages/medusa/src/api/routes/admin/users/list-users.ts @@ -6,6 +6,25 @@ import UserService from "../../../../services/user" * summary: "Retrieve all users" * description: "Retrieves all users." * x-authenticated: true + * 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: @@ -19,6 +38,18 @@ import UserService from "../../../../services/user" * type: array * items: * $ref: "#/components/schemas/user" + * "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" */ export default async (req, res) => { const userService: UserService = req.scope.resolve("userService") diff --git a/packages/medusa/src/api/routes/admin/users/reset-password-token.ts b/packages/medusa/src/api/routes/admin/users/reset-password-token.ts index 5da2d96315..807a188234 100644 --- a/packages/medusa/src/api/routes/admin/users/reset-password-token.ts +++ b/packages/medusa/src/api/routes/admin/users/reset-password-token.ts @@ -20,11 +20,51 @@ import { EntityManager } from "typeorm" * description: "The Users email." * type: string * format: email + * 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" */ export default async (req, res) => { const validated = await validator(AdminResetPasswordTokenRequest, req.body) diff --git a/packages/medusa/src/api/routes/admin/users/reset-password.ts b/packages/medusa/src/api/routes/admin/users/reset-password.ts index 70c2da56c1..f7769bcb5b 100644 --- a/packages/medusa/src/api/routes/admin/users/reset-password.ts +++ b/packages/medusa/src/api/routes/admin/users/reset-password.ts @@ -33,6 +33,33 @@ import { EntityManager } from "typeorm" * description: "The Users new password." * type: string * format: password + * 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: @@ -44,6 +71,18 @@ import { EntityManager } from "typeorm" * properties: * user: * $ref: "#/components/schemas/user" + * "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" */ export default async (req, res) => { const validated = await validator(AdminResetPasswordRequest, req.body) diff --git a/packages/medusa/src/api/routes/admin/users/update-user.ts b/packages/medusa/src/api/routes/admin/users/update-user.ts index 189af25cf3..7cc14d7005 100644 --- a/packages/medusa/src/api/routes/admin/users/update-user.ts +++ b/packages/medusa/src/api/routes/admin/users/update-user.ts @@ -34,7 +34,31 @@ import { EntityManager } from "typeorm" * metadata: * description: An optional set of key-value pairs with additional information. * type: object - * + * 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: @@ -46,6 +70,18 @@ import { EntityManager } from "typeorm" * properties: * user: * $ref: "#/components/schemas/user" + * "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" */ export default async (req, res) => { const { user_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/variants/list-variants.ts b/packages/medusa/src/api/routes/admin/variants/list-variants.ts index 6af7f741a0..9b996dfb3b 100644 --- a/packages/medusa/src/api/routes/admin/variants/list-variants.ts +++ b/packages/medusa/src/api/routes/admin/variants/list-variants.ts @@ -18,6 +18,25 @@ import { validator } from "../../../../utils/validator" * - (query) q {string} Query used for searching variants. * - (query) offset=0 {integer} How many variants to skip in the result. * - (query) limit=20 {integer} Limit the number of variants returned. + * 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: @@ -40,6 +59,18 @@ import { validator } from "../../../../utils/validator" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req, res) => { const variantService: ProductVariantService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/store/auth/create-session.ts b/packages/medusa/src/api/routes/store/auth/create-session.ts index b965e5d952..f2037a988c 100644 --- a/packages/medusa/src/api/routes/store/auth/create-session.ts +++ b/packages/medusa/src/api/routes/store/auth/create-session.ts @@ -13,6 +13,28 @@ import { EntityManager } from "typeorm" * parameters: * - (body) email=* {string} The Customer's email. * - (body) password=* {string} The Customer's password. + * 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.auth.authenticate({ + * email: 'user@example.com', + * password: 'user@example.com' + * }) + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/auth' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "email": "user@example.com", + * "password": "supersecret" + * }' * tags: * - Auth * responses: @@ -24,6 +46,18 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const validated = await validator(StorePostAuthReq, req.body) diff --git a/packages/medusa/src/api/routes/store/auth/delete-session.ts b/packages/medusa/src/api/routes/store/auth/delete-session.ts index 784b1e108f..91be8254ef 100644 --- a/packages/medusa/src/api/routes/store/auth/delete-session.ts +++ b/packages/medusa/src/api/routes/store/auth/delete-session.ts @@ -3,11 +3,32 @@ * operationId: "DeleteAuth" * summary: "Log out" * description: "Destroys a Customer's authenticated session." + * x-authenticated: true + * x-codeSamples: + * - lang: Shell + * label: cURL + * source: | + * curl --location --request DELETE 'https://medusa-url.com/store/auth' \ + * --header 'Cookie: connect.sid={sid}' + * security: + * - 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" */ export default async (req, res) => { req.session.jwt = {} diff --git a/packages/medusa/src/api/routes/store/auth/exists.ts b/packages/medusa/src/api/routes/store/auth/exists.ts index 6baeda0b75..0dbdc1a92c 100644 --- a/packages/medusa/src/api/routes/store/auth/exists.ts +++ b/packages/medusa/src/api/routes/store/auth/exists.ts @@ -12,6 +12,18 @@ import CustomerService from "../../../../services/customer" * format: email * required: true * description: The email to check if exists. + * 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.auth.exists('user@example.com') + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/auth/user@example.com' \ + * --header 'Cookie: connect.sid={sid}' * tags: * - Auth * responses: @@ -24,6 +36,16 @@ import CustomerService from "../../../../services/customer" * exists: * type: boolean * description: Whether email exists or not. + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { email } = req.params diff --git a/packages/medusa/src/api/routes/store/auth/get-session.ts b/packages/medusa/src/api/routes/store/auth/get-session.ts index af856a46f4..e37b4ec491 100644 --- a/packages/medusa/src/api/routes/store/auth/get-session.ts +++ b/packages/medusa/src/api/routes/store/auth/get-session.ts @@ -5,11 +5,27 @@ import CustomerService from "../../../../services/customer" * summary: "Get Session" * description: "Gets the currently logged in Customer." * x-authenticated: true + * 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 + * medusa.auth.getSession() + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/auth' \ + * --header 'Cookie: connect.sid={sid}' + * security: + * - cookie_auth: [] * tags: * - Auth * responses: - * "401": - * description: Unauthorized * "200": * description: OK * content: @@ -18,6 +34,18 @@ import CustomerService from "../../../../services/customer" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { if (req.user && req.user.customer_id) { diff --git a/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts b/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts index e1471eb649..a932102f47 100644 --- a/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts +++ b/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts @@ -11,12 +11,32 @@ import { validator } from "../../../../utils/validator" * operationId: "PostCartsCartShippingMethod" * description: "Adds a Shipping Method to the Cart." * summary: "Add a Shipping Method" - * tags: - * - Cart * parameters: * - (path) id=* {string} The cart ID. * - (body) option_id=* {string} ID of the shipping option to create the method from * - (body) data {Object} Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send. + * 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.carts.addShippingMethod(cart_id, { + * option_id + * }) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/shipping-methods' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "option_id": "{option_id}", + * }' + * tags: + * - Cart * responses: * "200": * description: OK @@ -26,6 +46,16 @@ import { validator } from "../../../../utils/validator" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts b/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts index 64e79befe3..62f378f234 100644 --- a/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts +++ b/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts @@ -12,6 +12,11 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * this may involve making 3rd party API calls to a Tax Provider service." * parameters: * - (path) id=* {String} The Cart ID. + * x-codeSamples: + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/taxes' * tags: * - Cart * responses: @@ -23,6 +28,16 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/complete-cart.ts b/packages/medusa/src/api/routes/store/carts/complete-cart.ts index 9362885efd..05305c680f 100644 --- a/packages/medusa/src/api/routes/store/carts/complete-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/complete-cart.ts @@ -15,6 +15,20 @@ import { IdempotencyKeyService } from "../../../../services" * will generate one for the request." * parameters: * - (path) id=* {String} The Cart id. + * 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.carts.complete(cart_id) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/complete' * tags: * - Cart * responses: @@ -50,6 +64,16 @@ import { IdempotencyKeyService } from "../../../../services" * properties: * cart: * $ref: "#/components/schemas/swap" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/create-cart.ts b/packages/medusa/src/api/routes/store/carts/create-cart.ts index 29cc39a6f6..9e26177075 100644 --- a/packages/medusa/src/api/routes/store/carts/create-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/create-cart.ts @@ -65,6 +65,20 @@ import { isDefined } from "../../../../utils"; * example: * ip: "::1" * user_agent: "Chrome" + * 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.carts.create() + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts' * tags: * - Cart * responses: @@ -76,6 +90,16 @@ import { isDefined } from "../../../../utils"; * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const validated = req.validatedBody as StorePostCartReq diff --git a/packages/medusa/src/api/routes/store/carts/create-line-item.ts b/packages/medusa/src/api/routes/store/carts/create-line-item.ts index eed62b2c78..6f4ef1ab71 100644 --- a/packages/medusa/src/api/routes/store/carts/create-line-item.ts +++ b/packages/medusa/src/api/routes/store/carts/create-line-item.ts @@ -17,6 +17,28 @@ import { FlagRouter } from "../../../../utils/flag-router" * - (body) variant_id=* {string} The id of the Product Variant to generate the Line Item from. * - (body) quantity=* {integer} The quantity of the Product Variant to add to the Line Item. * - (body) metadata {object} An optional key-value map with additional details about the Line Item. + * 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.carts.lineItems.create(cart_id, { + * variant_id, + * quantity: 1 + * }) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/line-items' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "variant_id": "{variant_id}", + * "quantity": 1 + * }' * tags: * - Cart * responses: @@ -28,6 +50,16 @@ import { FlagRouter } from "../../../../utils/flag-router" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/create-payment-sessions.ts b/packages/medusa/src/api/routes/store/carts/create-payment-sessions.ts index 537268ab2e..c7f7bfe485 100644 --- a/packages/medusa/src/api/routes/store/carts/create-payment-sessions.ts +++ b/packages/medusa/src/api/routes/store/carts/create-payment-sessions.ts @@ -11,6 +11,20 @@ import IdempotencyKeyService from "../../../../services/idempotency-key"; * description: "Creates Payment Sessions for each of the available Payment Providers in the Cart's Region." * parameters: * - (path) id=* {string} The id of the Cart. + * 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.carts.createPaymentSessions(cart_id) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions' * tags: * - Cart * responses: @@ -22,6 +36,16 @@ import IdempotencyKeyService from "../../../../services/idempotency-key"; * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/delete-discount.ts b/packages/medusa/src/api/routes/store/carts/delete-discount.ts index cdca0cdcc9..28fa514348 100644 --- a/packages/medusa/src/api/routes/store/carts/delete-discount.ts +++ b/packages/medusa/src/api/routes/store/carts/delete-discount.ts @@ -11,6 +11,20 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * parameters: * - (path) id=* {string} The id of the Cart. * - (path) code=* {string} The unique Discount code. + * 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.carts.deleteDiscount(cart_id, code) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/discounts/{code}' * tags: * - Cart * responses: @@ -22,6 +36,16 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id, code } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/delete-line-item.ts b/packages/medusa/src/api/routes/store/carts/delete-line-item.ts index e667ad26c7..dfb02f8d14 100644 --- a/packages/medusa/src/api/routes/store/carts/delete-line-item.ts +++ b/packages/medusa/src/api/routes/store/carts/delete-line-item.ts @@ -11,6 +11,20 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * parameters: * - (path) id=* {string} The id of the Cart. * - (path) line_id=* {string} The id of the Line Item. + * 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.carts.lineItems.delete(cart_id, line_id) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' * tags: * - Cart * responses: @@ -22,6 +36,16 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id, line_id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/delete-payment-session.ts b/packages/medusa/src/api/routes/store/carts/delete-payment-session.ts index 55ea6af601..42c0811d58 100644 --- a/packages/medusa/src/api/routes/store/carts/delete-payment-session.ts +++ b/packages/medusa/src/api/routes/store/carts/delete-payment-session.ts @@ -11,6 +11,20 @@ import { EntityManager } from "typeorm"; * parameters: * - (path) id=* {string} The id of the Cart. * - (path) provider_id=* {string} The id of the Payment Provider used to create the Payment Session to be deleted. + * 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.carts.deletePaymentSession(cart_id, 'manual') + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' * tags: * - Cart * responses: @@ -22,6 +36,16 @@ import { EntityManager } from "typeorm"; * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id, provider_id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/get-cart.ts b/packages/medusa/src/api/routes/store/carts/get-cart.ts index 4876a1e620..cf71f89f26 100644 --- a/packages/medusa/src/api/routes/store/carts/get-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/get-cart.ts @@ -8,6 +8,20 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * description: "Retrieves a Cart." * parameters: * - (path) id=* {string} The id of the Cart. + * 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.carts.retrieve(cart_id) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/carts/{id}' * tags: * - Cart * responses: @@ -19,6 +33,16 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/refresh-payment-session.ts b/packages/medusa/src/api/routes/store/carts/refresh-payment-session.ts index 131c066b65..0e1742d299 100644 --- a/packages/medusa/src/api/routes/store/carts/refresh-payment-session.ts +++ b/packages/medusa/src/api/routes/store/carts/refresh-payment-session.ts @@ -10,6 +10,20 @@ import { EntityManager } from "typeorm"; * parameters: * - (path) id=* {string} The id of the Cart. * - (path) provider_id=* {string} The id of the Payment Provider that created the Payment Session to be refreshed. + * 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.carts.refreshPaymentSession(cart_id, 'manual') + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual/refresh' * tags: * - Cart * responses: @@ -21,6 +35,16 @@ import { EntityManager } from "typeorm"; * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id, provider_id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/set-payment-session.ts b/packages/medusa/src/api/routes/store/carts/set-payment-session.ts index 8a8106e500..906348d456 100644 --- a/packages/medusa/src/api/routes/store/carts/set-payment-session.ts +++ b/packages/medusa/src/api/routes/store/carts/set-payment-session.ts @@ -14,6 +14,26 @@ import { validator } from "../../../../utils/validator" * parameters: * - (path) id=* {string} The ID of the Cart. * - (body) provider_id=* {string} The ID of the Payment Provider. + * 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.carts.setPaymentSession(cart_id, { + * provider_id: 'manual' + * }) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "provider_id": "manual" + * }' * tags: * - Cart * responses: @@ -25,6 +45,16 @@ import { validator } from "../../../../utils/validator" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/update-cart.ts b/packages/medusa/src/api/routes/store/carts/update-cart.ts index 206dd22014..b09ef00c95 100644 --- a/packages/medusa/src/api/routes/store/carts/update-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/update-cart.ts @@ -87,6 +87,26 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * example: * ip: "::1" * user_agent: "Chrome" + * 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.carts.update(cart_id, { + * email: 'user@example.com' + * }) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "email": "user@example.com" + * }' * tags: * - Cart * responses: @@ -98,6 +118,16 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/update-line-item.ts b/packages/medusa/src/api/routes/store/carts/update-line-item.ts index df81403938..25caeeaafe 100644 --- a/packages/medusa/src/api/routes/store/carts/update-line-item.ts +++ b/packages/medusa/src/api/routes/store/carts/update-line-item.ts @@ -15,6 +15,26 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * - (path) id=* {string} The id of the Cart. * - (path) line_id=* {string} The id of the Line Item. * - (body) quantity=* {integer} The quantity to set the Line Item to. + * 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.carts.lineItems.update(cart_id, line_id, { + * quantity: 1 + * }) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "quantity": 1 + * }' * tags: * - Cart * responses: @@ -26,6 +46,16 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id, line_id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/update-payment-session.ts b/packages/medusa/src/api/routes/store/carts/update-payment-session.ts index 67b9ca8aed..9bbce00f08 100644 --- a/packages/medusa/src/api/routes/store/carts/update-payment-session.ts +++ b/packages/medusa/src/api/routes/store/carts/update-payment-session.ts @@ -14,6 +14,28 @@ import { EntityManager } from "typeorm"; * - (path) id=* {string} The id of the Cart. * - (path) provider_id=* {string} The id of the payment provider. * - (body) data=* {object} The data to update the payment session with. + * 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.carts.updatePaymentSession(cart_id, 'manual', { + * data: { + * + * } + * }) + * .then(({ cart }) => { + * console.log(cart.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "data": {} + * }' * tags: * - Cart * responses: @@ -25,6 +47,16 @@ import { EntityManager } from "typeorm"; * properties: * cart: * $ref: "#/components/schemas/cart" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id, provider_id } = req.params diff --git a/packages/medusa/src/api/routes/store/collections/get-collection.ts b/packages/medusa/src/api/routes/store/collections/get-collection.ts index 404fae2583..a810ecf8f7 100644 --- a/packages/medusa/src/api/routes/store/collections/get-collection.ts +++ b/packages/medusa/src/api/routes/store/collections/get-collection.ts @@ -6,6 +6,20 @@ import ProductCollectionService from "../../../../services/product-collection" * description: "Retrieves a Product Collection." * parameters: * - (path) id=* {string} The id of the Product Collection + * 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.collections.retrieve(collection_id) + * .then(({ collection }) => { + * console.log(collection.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/collections/{id}' * tags: * - Collection * responses: @@ -17,6 +31,16 @@ import ProductCollectionService from "../../../../services/product-collection" * properties: * collection: * $ref: "#/components/schemas/product_collection" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/store/collections/list-collections.ts b/packages/medusa/src/api/routes/store/collections/list-collections.ts index 975eb21096..948599d0ee 100644 --- a/packages/medusa/src/api/routes/store/collections/list-collections.ts +++ b/packages/medusa/src/api/routes/store/collections/list-collections.ts @@ -57,6 +57,20 @@ import { validator } from "../../../../utils/validator" * type: string * description: filter by dates greater than or equal to this date * format: date + * 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.collections.list() + * .then(({ collections, limit, offset, count }) => { + * console.log(collections.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/collections' * tags: * - Collection * responses: @@ -79,6 +93,16 @@ import { validator } from "../../../../utils/validator" * limit: * type: integer * description: The number of items per page + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const validated = await validator(StoreGetCollectionsParams, req.query) diff --git a/packages/medusa/src/api/routes/store/customers/create-address.ts b/packages/medusa/src/api/routes/store/customers/create-address.ts index a0c2c488ea..87b3f8394f 100644 --- a/packages/medusa/src/api/routes/store/customers/create-address.ts +++ b/packages/medusa/src/api/routes/store/customers/create-address.ts @@ -23,6 +23,49 @@ import { EntityManager } from "typeorm" * description: "The Address to add to the Customer." * anyOf: * - $ref: "#/components/schemas/address" + * 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 + * medusa.customers.addresses.addAddress({ + * address: { + * first_name: 'Celia', + * last_name: 'Schumm', + * address_1: '225 Bednar Curve', + * city: 'Danielville', + * country_code: 'US', + * postal_code: '85137', + * phone: '981-596-6748 x90188', + * company: 'Wyman LLC', + * address_2: '', + * province: 'Georgia', + * metadata: {} + * } + * }) + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/customers/me/addresses' \ + * --header 'Cookie: connect.sid={sid}' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "address": { + * "first_name": "Celia", + * "last_name": "Schumm", + * "address_1": "225 Bednar Curve", + * "city": "Danielville", + * "country_code": "US", + * "postal_code": "85137" + * } + * }' + * security: + * - cookie_auth: [] * tags: * - Customer * responses: @@ -34,6 +77,18 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const id = req.user.customer_id diff --git a/packages/medusa/src/api/routes/store/customers/create-customer.ts b/packages/medusa/src/api/routes/store/customers/create-customer.ts index 2bf26a9533..2b2646c840 100644 --- a/packages/medusa/src/api/routes/store/customers/create-customer.ts +++ b/packages/medusa/src/api/routes/store/customers/create-customer.ts @@ -39,6 +39,32 @@ import { EntityManager } from "typeorm" * phone: * description: "The Customer's phone number." * 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 }) + * medusa.customers.create({ + * first_name: 'Alec', + * last_name: 'Reynolds', + * email: 'user@example.com', + * password: 'supersecret' + * }) + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/customers' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "first_name": "Alec", + * "last_name": "Reynolds", + * "email": "user@example.com", + * "password": "supersecret" + * }' * tags: * - Customer * responses: @@ -69,6 +95,14 @@ import { EntityManager } from "typeorm" * code: "invalid_request_error" * type: "duplicate_error" * message: "A customer with the given email already has an account. Log in instead" + * "400": + * $ref: "#/components/responses/400_error" + * "404": + * $ref: "#/components/responses/not_found_error" + * "409": + * $ref: "#/components/responses/invalid_state_error" + * "500": + * $ref: "#/components/responses/500_error" */ export default async (req, res) => { const validated = await validator(StorePostCustomersReq, req.body) diff --git a/packages/medusa/src/api/routes/store/customers/delete-address.ts b/packages/medusa/src/api/routes/store/customers/delete-address.ts index f42f7f3623..b8e104b877 100644 --- a/packages/medusa/src/api/routes/store/customers/delete-address.ts +++ b/packages/medusa/src/api/routes/store/customers/delete-address.ts @@ -11,6 +11,24 @@ import { EntityManager } from "typeorm" * x-authenticated: true * parameters: * - (path) address_id=* {string} The id of the Address to remove. + * 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 + * medusa.customers.addresses.deleteAddress(address_id) + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request DELETE 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + * --header 'Cookie: connect.sid={sid}' + * security: + * - cookie_auth: [] * tags: * - Customer * responses: @@ -22,6 +40,18 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const id = req.user.customer_id diff --git a/packages/medusa/src/api/routes/store/customers/get-customer.ts b/packages/medusa/src/api/routes/store/customers/get-customer.ts index 0d1d153b98..b5404355b5 100644 --- a/packages/medusa/src/api/routes/store/customers/get-customer.ts +++ b/packages/medusa/src/api/routes/store/customers/get-customer.ts @@ -7,6 +7,24 @@ import CustomerService from "../../../../services/customer" * summary: Retrieves a Customer * description: "Retrieves a Customer - the Customer must be logged in to retrieve their details." * x-authenticated: true + * 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 + * medusa.customers.retrieve() + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/customers/me' \ + * --header 'Cookie: connect.sid={sid}' + * security: + * - cookie_auth: [] * tags: * - Customer * responses: @@ -18,6 +36,18 @@ import CustomerService from "../../../../services/customer" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const id = req.user.customer_id diff --git a/packages/medusa/src/api/routes/store/customers/get-payment-methods.ts b/packages/medusa/src/api/routes/store/customers/get-payment-methods.ts index c964102669..35c284833c 100644 --- a/packages/medusa/src/api/routes/store/customers/get-payment-methods.ts +++ b/packages/medusa/src/api/routes/store/customers/get-payment-methods.ts @@ -10,6 +10,24 @@ import { PaymentProvider } from "../../../../models" * summary: Retrieve saved payment methods * description: "Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods." * x-authenticated: true + * 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 + * medusa.customers.paymentMethods.list() + * .then(({ payment_methods }) => { + * console.log(payment_methods.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/customers/me/payment-methods' \ + * --header 'Cookie: connect.sid={sid}' + * security: + * - cookie_auth: [] * tags: * - Customer * responses: @@ -29,6 +47,18 @@ import { PaymentProvider } from "../../../../models" * data: * type: object * description: The data needed for the Payment Provider to use the saved payment method. + * "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" */ export default async (req, res) => { const id = req.user.customer_id diff --git a/packages/medusa/src/api/routes/store/customers/list-orders.ts b/packages/medusa/src/api/routes/store/customers/list-orders.ts index 5019475b42..9b8f0db48a 100644 --- a/packages/medusa/src/api/routes/store/customers/list-orders.ts +++ b/packages/medusa/src/api/routes/store/customers/list-orders.ts @@ -129,6 +129,24 @@ import { Type } from "class-transformer" * - (query) offset=0 {integer} The offset in the resulting orders. * - (query) fields {string} (Comma separated string) Which fields should be included in the resulting orders. * - (query) expand {string} (Comma separated string) Which relations should be expanded in the resulting orders. + * 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 + * medusa.customers.listOrders() + * .then(({ orders, limit, offset, count }) => { + * console.log(orders); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/customers/me/orders' \ + * --header 'Cookie: connect.sid={sid}' + * security: + * - cookie_auth: [] * tags: * - Customer * responses: @@ -151,6 +169,18 @@ import { Type } from "class-transformer" * limit: * type: integer * description: The number of items per page + * "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" */ export default async (req: Request, res: Response) => { const id: string | undefined = req.user?.customer_id diff --git a/packages/medusa/src/api/routes/store/customers/reset-password-token.ts b/packages/medusa/src/api/routes/store/customers/reset-password-token.ts index 26de59e6d2..4ff708369a 100644 --- a/packages/medusa/src/api/routes/store/customers/reset-password-token.ts +++ b/packages/medusa/src/api/routes/store/customers/reset-password-token.ts @@ -19,11 +19,46 @@ import { EntityManager } from "typeorm" * description: "The email of the customer." * type: string * format: email + * 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.customers.generatePasswordToken({ + * email: 'user@example.com' + * }) + * .then(() => { + * // successful + * }) + * .catch(() => { + * // failed + * }) + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/customers/password-token' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "email": "user@example.com" + * }' * tags: * - Customer * 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" */ export default async (req, res) => { const validated = await validator( diff --git a/packages/medusa/src/api/routes/store/customers/reset-password.ts b/packages/medusa/src/api/routes/store/customers/reset-password.ts index 9af27db335..84138d3732 100644 --- a/packages/medusa/src/api/routes/store/customers/reset-password.ts +++ b/packages/medusa/src/api/routes/store/customers/reset-password.ts @@ -30,6 +30,30 @@ import { EntityManager } from "typeorm" * token: * description: "The reset password token" * 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 }) + * medusa.customers.resetPassword({ + * email: 'user@example.com', + * password: 'supersecret', + * token: 'supersecrettoken' + * }) + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/customers/password-reset' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "email": "user@example.com", + * "password": "supersecret", + * "token": "supersecrettoken" + * }' * tags: * - Customer * responses: @@ -41,6 +65,18 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const validated = await validator( diff --git a/packages/medusa/src/api/routes/store/customers/update-address.ts b/packages/medusa/src/api/routes/store/customers/update-address.ts index fbbc809189..bd68481e73 100644 --- a/packages/medusa/src/api/routes/store/customers/update-address.ts +++ b/packages/medusa/src/api/routes/store/customers/update-address.ts @@ -19,6 +19,30 @@ import { EntityManager } from "typeorm" * schema: * anyOf: * - $ref: "#/components/schemas/address" + * 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 + * medusa.customers.addresses.updateAddress(address_id, { + * first_name: 'Gina' + * }) + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + * --header 'Cookie: connect.sid={sid}' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "first_name": "Gina" + * }' + * security: + * - cookie_auth: [] * tags: * - Customer * responses: @@ -30,6 +54,18 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const id = req.user.customer_id diff --git a/packages/medusa/src/api/routes/store/customers/update-customer.ts b/packages/medusa/src/api/routes/store/customers/update-customer.ts index 7f93d52bd2..8d5a2d463a 100644 --- a/packages/medusa/src/api/routes/store/customers/update-customer.ts +++ b/packages/medusa/src/api/routes/store/customers/update-customer.ts @@ -43,6 +43,30 @@ import { EntityManager } from "typeorm" * metadata: * description: "Metadata about the customer." * type: object + * 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 + * medusa.customers.update({ + * first_name: 'Laury' + * }) + * .then(({ customer }) => { + * console.log(customer.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/customers/me' \ + * --header 'Cookie: connect.sid={sid}' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "first_name": "Laury" + * }' + * security: + * - cookie_auth: [] * tags: * - Customer * responses: @@ -54,6 +78,18 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * "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" */ export default async (req, res) => { const id = req.user.customer_id diff --git a/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts b/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts index 1b4b2e8b7d..d4dc1372fc 100644 --- a/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts +++ b/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts @@ -9,6 +9,20 @@ import GiftCardService from "../../../../services/gift-card" * description: "Retrieves a Gift Card by its associated unqiue code." * parameters: * - (path) code=* {string} The unique Gift Card code. + * 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.giftCards.retrieve(code) + * .then(({ gift_card }) => { + * console.log(gift_card.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/gift-cards/{code}' * tags: * - Gift Card * responses: @@ -20,6 +34,16 @@ import GiftCardService from "../../../../services/gift-card" * properties: * gift_card: * $ref: "#/components/schemas/gift_card" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { code } = req.params diff --git a/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts b/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts index 7dd63384bd..f83cfde797 100644 --- a/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts +++ b/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts @@ -9,6 +9,20 @@ import { OrderService } from "../../../../services" * description: "Retrieves an Order by the id of the Cart that was used to create the Order." * parameters: * - (path) cart_id=* {string} The ID of Cart. + * 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.orders.retrieveByCartId(cart_id) + * .then(({ order }) => { + * console.log(order.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/orders/cart/{id}' * tags: * - Order * responses: @@ -20,6 +34,16 @@ import { OrderService } from "../../../../services" * properties: * order: * $ref: "#/components/schemas/order" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { cart_id } = req.params diff --git a/packages/medusa/src/api/routes/store/orders/get-order.ts b/packages/medusa/src/api/routes/store/orders/get-order.ts index fb4218bc47..248d9686f2 100644 --- a/packages/medusa/src/api/routes/store/orders/get-order.ts +++ b/packages/medusa/src/api/routes/store/orders/get-order.ts @@ -9,6 +9,20 @@ import { OrderService } from "../../../../services" * description: "Retrieves an Order" * parameters: * - (path) id=* {string} The id of the Order. + * 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.orders.retrieve(order_id) + * .then(({ order }) => { + * console.log(order.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/orders/{id}' * tags: * - Order * responses: @@ -20,6 +34,16 @@ import { OrderService } from "../../../../services" * properties: * order: * $ref: "#/components/schemas/order" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/orders/lookup-order.ts b/packages/medusa/src/api/routes/store/orders/lookup-order.ts index 2efb40b718..b351b1d106 100644 --- a/packages/medusa/src/api/routes/store/orders/lookup-order.ts +++ b/packages/medusa/src/api/routes/store/orders/lookup-order.ts @@ -38,6 +38,23 @@ import { validator } from "../../../../utils/validator" * postal_code: * type: string * description: The postal code of the shipping address + * 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.orders.lookupOrder({ + * display_id: 1, + * email: 'user@example.com' + * }) + * .then(({ order }) => { + * console.log(order.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/orders?display_id=1&email=user@example.com' * tags: * - Order * responses: @@ -49,6 +66,16 @@ import { validator } from "../../../../utils/validator" * properties: * order: * $ref: "#/components/schemas/order" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const validated = await validator(StoreGetOrdersParams, req.query) diff --git a/packages/medusa/src/api/routes/store/products/get-product.ts b/packages/medusa/src/api/routes/store/products/get-product.ts index 53a3a6ee20..9ea12010f9 100644 --- a/packages/medusa/src/api/routes/store/products/get-product.ts +++ b/packages/medusa/src/api/routes/store/products/get-product.ts @@ -15,6 +15,20 @@ import { validator } from "../../../../utils/validator" * description: "Retrieves a Product." * parameters: * - (path) id=* {string} The id of the Product. + * 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.products.retrieve(product_id) + * .then(({ product }) => { + * console.log(product.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/products/{id}' * tags: * - Product * responses: @@ -26,6 +40,16 @@ import { validator } from "../../../../utils/validator" * properties: * product: * $ref: "#/components/schemas/product" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/products/list-products.ts b/packages/medusa/src/api/routes/store/products/list-products.ts index 972556952f..e6bd6d5b16 100644 --- a/packages/medusa/src/api/routes/store/products/list-products.ts +++ b/packages/medusa/src/api/routes/store/products/list-products.ts @@ -113,6 +113,20 @@ import { isDefined } from "../../../../utils" * - (query) limit=100 {integer} Limit the number of products returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each order of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each order of the result. + * 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.products.list() + * .then(({ products, limit, offset, count }) => { + * console.log(products.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/products' * tags: * - Product * responses: @@ -135,6 +149,16 @@ import { isDefined } from "../../../../utils" * limit: * type: integer * description: The number of items per page + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const productService: ProductService = req.scope.resolve("productService") diff --git a/packages/medusa/src/api/routes/store/products/search.ts b/packages/medusa/src/api/routes/store/products/search.ts index d8d61e1448..c826fdd08d 100644 --- a/packages/medusa/src/api/routes/store/products/search.ts +++ b/packages/medusa/src/api/routes/store/products/search.ts @@ -6,8 +6,8 @@ import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" /** - * @oas [get] /products/search - * operationId: GetProductsSearch + * @oas [post] /products/search + * operationId: PostProductsSearch * summary: Search Products * description: "Run a search query on products using the search engine installed on Medusa" * parameters: @@ -15,6 +15,22 @@ import { validator } from "../../../../utils/validator" * - (query) offset {integer} How many products to skip in the result. * - (query) limit {integer} Limit the number of products returned. * - (query) filter {} Filter based on the search engine. + * 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.products.search({ + * q: 'Shirt' + * }) + * .then(({ hits }) => { + * console.log(hits.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/products/search?q=Shirt' * tags: * - Product * responses: @@ -27,6 +43,16 @@ import { validator } from "../../../../utils/validator" * hits: * type: array * description: Array of results. The format of the items depends on the search engine installed on the server. + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { // As we want to allow wildcards, we pass a config allowing this diff --git a/packages/medusa/src/api/routes/store/regions/get-region.ts b/packages/medusa/src/api/routes/store/regions/get-region.ts index 83a80422d0..d7766d6079 100644 --- a/packages/medusa/src/api/routes/store/regions/get-region.ts +++ b/packages/medusa/src/api/routes/store/regions/get-region.ts @@ -6,6 +6,20 @@ import RegionService from "../../../../services/region" * description: "Retrieves a Region." * parameters: * - (path) id=* {string} The id of the Region. + * 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.regions.retrieve(region_id) + * .then(({ region }) => { + * console.log(region.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/regions/{id}' * tags: * - Region * responses: @@ -17,6 +31,16 @@ import RegionService from "../../../../services/region" * properties: * region: * $ref: "#/components/schemas/region" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/store/regions/list-regions.ts b/packages/medusa/src/api/routes/store/regions/list-regions.ts index ffdf84a351..7f311881da 100644 --- a/packages/medusa/src/api/routes/store/regions/list-regions.ts +++ b/packages/medusa/src/api/routes/store/regions/list-regions.ts @@ -58,6 +58,20 @@ import { validator } from "../../../../utils/validator" * type: string * description: filter by dates greater than or equal to this date * format: date + * 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.regions.list() + * .then(({ regions }) => { + * console.log(regions.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/regions' * tags: * - Region * responses: @@ -71,6 +85,16 @@ import { validator } from "../../../../utils/validator" * type: array * items: * $ref: "#/components/schemas/region" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const validated = await validator(StoreGetRegionsParams, req.query) diff --git a/packages/medusa/src/api/routes/store/return-reasons/get-reason.ts b/packages/medusa/src/api/routes/store/return-reasons/get-reason.ts index 47870eea97..241d1166a4 100644 --- a/packages/medusa/src/api/routes/store/return-reasons/get-reason.ts +++ b/packages/medusa/src/api/routes/store/return-reasons/get-reason.ts @@ -11,6 +11,20 @@ import ReturnReasonService from "../../../../services/return-reason" * description: "Retrieves a Return Reason." * parameters: * - (path) id=* {string} The id of the Return Reason. + * 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.returnReasons.retrieve(reason_id) + * .then(({ return_reason }) => { + * console.log(return_reason.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/return-reasons/{id}' * tags: * - Return Reason * responses: @@ -22,6 +36,16 @@ import ReturnReasonService from "../../../../services/return-reason" * properties: * return_reason: * $ref: "#/components/schemas/return_reason" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/return-reasons/list-reasons.ts b/packages/medusa/src/api/routes/store/return-reasons/list-reasons.ts index c6cece9e49..d556180beb 100644 --- a/packages/medusa/src/api/routes/store/return-reasons/list-reasons.ts +++ b/packages/medusa/src/api/routes/store/return-reasons/list-reasons.ts @@ -9,6 +9,20 @@ import ReturnReasonService from "../../../../services/return-reason" * operationId: "GetReturnReasons" * summary: "List Return Reasons" * description: "Retrieves a list of Return Reasons." + * 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.returnReasons.list() + * .then(({ return_reasons }) => { + * console.log(return_reasons.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/return-reasons' * tags: * - Return Reason * responses: @@ -22,6 +36,16 @@ import ReturnReasonService from "../../../../services/return-reason" * type: array * items: * $ref: "#/components/schemas/return_reason" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const returnReasonService: ReturnReasonService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/store/returns/create-return.ts b/packages/medusa/src/api/routes/store/returns/create-return.ts index e93538dcfc..354506f88e 100644 --- a/packages/medusa/src/api/routes/store/returns/create-return.ts +++ b/packages/medusa/src/api/routes/store/returns/create-return.ts @@ -62,6 +62,38 @@ import { validator } from "../../../../utils/validator" * option_id: * type: string * description: The ID of the Shipping Option to create the Shipping Method from. + * 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.returns.create({ + * order_id, + * items: [ + * { + * item_id, + * quantity: 1 + * } + * ] + * }) + * .then(({ return }) => { + * console.log(return.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/returns' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "order_id": "asfasf", + * "items": [ + * { + * "item_id": "assfasf", + * "quantity": 1 + * } + * ] + * }' * tags: * - Return * responses: @@ -73,6 +105,16 @@ import { validator } from "../../../../utils/validator" * properties: * return: * $ref: "#/components/schemas/return" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const returnDto = await validator(StorePostReturnsReq, req.body) diff --git a/packages/medusa/src/api/routes/store/shipping-options/list-options.ts b/packages/medusa/src/api/routes/store/shipping-options/list-options.ts index 1d2f7ae04b..452184509a 100644 --- a/packages/medusa/src/api/routes/store/shipping-options/list-options.ts +++ b/packages/medusa/src/api/routes/store/shipping-options/list-options.ts @@ -12,6 +12,20 @@ import { validator } from "../../../../utils/validator" * - (query) is_return {boolean} Whether return Shipping Options should be included. By default all Shipping Options are returned. * - (query) product_ids {string} A comma separated list of Product ids to filter Shipping Options by. * - (query) region_id {string} the Region to retrieve Shipping Options from. + * 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.shippingOptions.list() + * .then(({ shipping_options }) => { + * console.log(shipping_options.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/shipping-options' * tags: * - Shipping Option * responses: @@ -25,6 +39,16 @@ import { validator } from "../../../../utils/validator" * type: array * items: * $ref: "#/components/schemas/shipping_option" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const validated = await validator(StoreGetShippingOptionsParams, req.query) diff --git a/packages/medusa/src/api/routes/store/shipping-options/list-shipping-options.ts b/packages/medusa/src/api/routes/store/shipping-options/list-shipping-options.ts index 764f0fbbe4..8711654ce2 100644 --- a/packages/medusa/src/api/routes/store/shipping-options/list-shipping-options.ts +++ b/packages/medusa/src/api/routes/store/shipping-options/list-shipping-options.ts @@ -8,6 +8,20 @@ import ShippingProfileService from "../../../../services/shipping-profile" * description: "Retrieves a list of Shipping Options available to a cart." * parameters: * - (path) cart_id {string} The id of the Cart. + * 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.shippingOptions.listCartOptions(cart_id) + * .then(({ shipping_options }) => { + * console.log(shipping_options.length); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/shipping-options/{cart_id}' * tags: * - Shipping Option * responses: @@ -21,6 +35,16 @@ import ShippingProfileService from "../../../../services/shipping-profile" * type: array * items: * $ref: "#/components/schemas/shipping_option" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { cart_id } = req.params diff --git a/packages/medusa/src/api/routes/store/swaps/create-swap.ts b/packages/medusa/src/api/routes/store/swaps/create-swap.ts index c5a261da28..aa80523c19 100644 --- a/packages/medusa/src/api/routes/store/swaps/create-swap.ts +++ b/packages/medusa/src/api/routes/store/swaps/create-swap.ts @@ -72,6 +72,50 @@ import { validator } from "../../../../utils/validator" * quantity: * description: The quantity to send of the variant. * type: integer + * 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.swaps.create({ + * order_id, + * return_items: [ + * { + * item_id, + * quantity: 1 + * } + * ], + * additional_items: [ + * { + * variant_id, + * quantity: 1 + * } + * ] + * }) + * .then(({ swap }) => { + * console.log(swap.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request POST 'https://medusa-url.com/store/swaps' \ + * --header 'Content-Type: application/json' \ + * --data-raw '{ + * "order_id": "asfasf", + * "return_items": [ + * { + * "item_id": "asfas", + * "quantity": 1 + * } + * ], + * "additional_items": [ + * { + * "variant_id": "asfas", + * "quantity": 1 + * } + * ] + * }' * tags: * - Swap * responses: @@ -83,6 +127,16 @@ import { validator } from "../../../../utils/validator" * properties: * swap: * $ref: "#/components/schemas/swap" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const swapDto = await validator(StorePostSwapsReq, req.body) diff --git a/packages/medusa/src/api/routes/store/swaps/get-swap-by-cart.ts b/packages/medusa/src/api/routes/store/swaps/get-swap-by-cart.ts index 3298ed7054..99f842ff65 100644 --- a/packages/medusa/src/api/routes/store/swaps/get-swap-by-cart.ts +++ b/packages/medusa/src/api/routes/store/swaps/get-swap-by-cart.ts @@ -6,6 +6,20 @@ import SwapService from "../../../../services/swap" * description: "Retrieves a Swap by the id of the Cart used to confirm the Swap." * parameters: * - (path) cart_id {string} The id of the Cart + * 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.swaps.retrieveByCartId(cart_id) + * .then(({ swap }) => { + * console.log(swap.id); + * }); + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/swaps/{cart_id}' * tags: * - Swap * responses: @@ -17,6 +31,16 @@ import SwapService from "../../../../services/swap" * properties: * swap: * $ref: "#/components/schemas/swap" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { cart_id } = req.params diff --git a/packages/medusa/src/api/routes/store/variants/get-variant.ts b/packages/medusa/src/api/routes/store/variants/get-variant.ts index da5634678f..ea47f3b065 100644 --- a/packages/medusa/src/api/routes/store/variants/get-variant.ts +++ b/packages/medusa/src/api/routes/store/variants/get-variant.ts @@ -28,6 +28,11 @@ import { validator } from "../../../../utils/validator" * externalDocs: * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes * description: See a list of codes. + * x-codeSamples: + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/variants/{id}' * tags: * - Product Variant * responses: @@ -39,6 +44,16 @@ import { validator } from "../../../../utils/validator" * properties: * variant: * $ref: "#/components/schemas/product_variant" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/variants/list-variants.ts b/packages/medusa/src/api/routes/store/variants/list-variants.ts index 75bfdff6c8..01be56e307 100644 --- a/packages/medusa/src/api/routes/store/variants/list-variants.ts +++ b/packages/medusa/src/api/routes/store/variants/list-variants.ts @@ -60,6 +60,11 @@ import { validator } from "../../../../utils/validator" * gte: * type: number * description: filter by inventory quantity greater than or equal to this number + * x-codeSamples: + * - lang: Shell + * label: cURL + * source: | + * curl --location --request GET 'https://medusa-url.com/store/variants' * tags: * - Product Variant * responses: @@ -73,6 +78,16 @@ import { validator } from "../../../../utils/validator" * type: array * items: * $ref: "#/components/schemas/product_variant" + * "400": + * $ref: "#/components/responses/400_error" + * "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" */ export default async (req, res) => { const validated = await validator(StoreGetVariantsParams, req.query) diff --git a/scripts/build-openapi.js b/scripts/build-openapi.js index c219624ab2..2fd99bffe4 100755 --- a/scripts/build-openapi.js +++ b/scripts/build-openapi.js @@ -4,15 +4,14 @@ const fs = require("fs") const OAS = require("oas-normalize") const swaggerInline = require("swagger-inline") const { exec } = require("child_process"); -const { exit } = require("process"); const isDryRun = process.argv.indexOf('--dry-run') !== -1; // Storefront API swaggerInline( - ["./packages/medusa/src/models", "./packages/medusa/src/api/routes/store"], + ["./packages/medusa/src/models", "./packages/medusa/src/api/middlewares" , "./packages/medusa/src/api/routes/store"], { - base: "./docs/api/store-spec3-base.json", + base: "./docs/api/store-spec3-base.yaml", } ).then((gen) => { const oas = new OAS(gen) @@ -31,9 +30,9 @@ swaggerInline( }) swaggerInline( - ["./packages/medusa/src/models", "./packages/medusa/src/api/routes/store"], + ["./packages/medusa/src/models", "./packages/medusa/src/api/middlewares" , "./packages/medusa/src/api/routes/store"], { - base: "./docs/api/store-spec3-base.json", + base: "./docs/api/store-spec3-base.yaml", format: "yaml", } ).then((gen) => { @@ -52,9 +51,9 @@ swaggerInline( // Admin API swaggerInline( - ["./packages/medusa/src/models", "./packages/medusa/src/api/routes/admin"], + ["./packages/medusa/src/models", "./packages/medusa/src/api/middlewares" , "./packages/medusa/src/api/routes/admin"], { - base: "./docs/api/admin-spec3-base.json", + base: "./docs/api/admin-spec3-base.yaml", } ).then((gen) => { const oas = new OAS(gen) @@ -73,9 +72,9 @@ swaggerInline( }) swaggerInline( - ["./packages/medusa/src/models", "./packages/medusa/src/api/routes/admin"], + ["./packages/medusa/src/models", "./packages/medusa/src/api/middlewares" , "./packages/medusa/src/api/routes/admin"], { - base: "./docs/api/admin-spec3-base.json", + base: "./docs/api/admin-spec3-base.yaml", format: "yaml", } ).then((gen) => { @@ -91,4 +90,4 @@ swaggerInline( } else { console.log('No errors occurred while generating Admin API Reference'); } -}) +}) \ No newline at end of file diff --git a/www/docs/docusaurus.config.js b/www/docs/docusaurus.config.js index cd7889e104..f7f818c515 100644 --- a/www/docs/docusaurus.config.js +++ b/www/docs/docusaurus.config.js @@ -64,6 +64,11 @@ module.exports = { sidebarId: "tutorialSidebar", label: "Docs" }, + { + type: "docSidebar", + sidebarId: "userGuideSidebar", + label: "User Guide" + }, { type: 'dropdown', label: 'REST API Reference', @@ -223,10 +228,11 @@ module.exports = { expandResponses: "200,204", generatedPayloadSamplesMaxDepth: 4, showObjectSchemaExamples: true, - requiredPropsFirst: true + requiredPropsFirst: true, + hideRequestPayloadSample: true } } }, ], ], -} +} \ No newline at end of file diff --git a/www/docs/sidebars.js b/www/docs/sidebars.js index 5dcc30daa1..3b055872a5 100644 --- a/www/docs/sidebars.js +++ b/www/docs/sidebars.js @@ -495,121 +495,9 @@ module.exports = { ], userGuideSidebar: [ { - type: "doc", - id: "user-guide/index", - label: "Introduction" - }, - { - type: "category", - collapsed: false, - label: "Orders", - items: [ - { - type: "doc", - id: "user-guide/orders/index" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Products", - items: [ - { - type: "doc", - id: "user-guide/products/index" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Customers", - items: [ - { - type: "doc", - id: "user-guide/customers/index" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Discounts", - items: [ - { - type: "doc", - id: "user-guide/discounts/index" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Gift Cards", - items: [ - { - type: "doc", - id: "user-guide/gift-cards/index" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Price Lists", - items: [ - { - type: "doc", - id: "user-guide/price-lists/index" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Regions", - items: [ - { - type: "doc", - id: "user-guide/regions/index" - }, - { - type: "doc", - id: "user-guide/regions/manage" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Taxes", - items: [ - { - type: "doc", - id: "user-guide/taxes/index" - }, - { - type: "doc", - id: "user-guide/taxes/manage" - } - ] - }, - { - type: "category", - collapsed: false, - label: "Sales Channels", - items: [ - { - type: "doc", - id: "user-guide/sales-channels/index" - }, - { - type: "doc", - id: "user-guide/sales-channels/manage" - } - ] - }, + type: 'autogenerated', + dirName: 'user-guide', // '.' means the current docs folder + } ], servicesSidebar: [ { diff --git a/www/docs/src/css/custom.css b/www/docs/src/css/custom.css index 7980436b53..9b2f3f2f29 100644 --- a/www/docs/src/css/custom.css +++ b/www/docs/src/css/custom.css @@ -332,6 +332,23 @@ html[data-theme="dark"] .redocusaurus .expanded + tr > td > div { color: var(--ifm-link-color) !important; } +.redocusaurus [data-section-id] > div:nth-child(2) pre { + background-color: transparent !important; + margin-top: 10px; +} + +html[data-theme="dark"] .redocusaurus h5 + svg { + fill: #fff; +} + +html[data-theme="dark"] .redocusaurus h2 + div + div > div + div { + padding: 8px 9.6px; +} + +html[data-theme="dark"] .redocusaurus h2 + div + div > div + div { + background-color: #11171a; +} + /* User Guide Styling */ html[data-theme="dark"] kbd { --ifm-color-emphasis-0: var(--ifm-color-gray-200);