Magento 2 API How to create a quote

When a customer first adds an item to their shopping cart, Magento produces a quote. Magento uses a quotation to perform tasks such as:

Type of carts

There are 3 type of user that can create a shopping cart:

Create a cart for log-in user

I will use Postman to interact with Magento 2 API and create a quote. First you have to generate a customer access token with this endpoint:

POST /rest/<store_code>/V1/integration/customer/token

{
  "username": "string",
  "password": "string"
}

generate customer access token

Create a Post request with this endpoint

POST /rest/<store_code>/V1/carts/mine

Enter access token as Bearer token in Authorization section

Then click Send

The response is the quoteId

Quote id return

You have created cartId for your quote. QuoteId appears nowhere on the website or in Admin. Therefore, you don’t have to verify this id.

I have shown you how to create a quote for your customer account using Magento 2 API. With this quote, you can add items to carts and much more. Read our posts to learn more about Magento API. For more information please read Magento DevDocs.

Last updated: