title: Magento 2 REST-API POST V1/guest-carts/{cartId}/items either 400 or 404
body: <p>I'm struggling to add a product to a guest cart using the REST-API. I tried different methods that either result in 404 or 400 errors.</p>
  <p>The first method is from the docs, or at leas how I interpret them. The second method is from another stack exchange answer. I must be overlooking or confusing something. What is the right method?</p>
  <p><strong>FIRST METHOD:</strong></p>
  <p><strong>Create a new guest cart</strong></p>
  <p>Request</p>
  <pre><code>POST: V1/guest-carts
  </code></pre>
  <p>Response:</p>
  <pre><code>&quot;EDzeXsnat8aODucV5zRVa6o7yChZ9je9&quot;
  </code></pre>
  <p><strong>Add product to guest cart</strong></p>
  <p>Request</p>
  <pre><code>POST: V1/guest-carts/EDzeXsnat8aODucV5zRVa6o7yChZ9je9/items
  
  {
    &quot;cart_item&quot;: {
      &quot;quote_id&quot;: &quot;EDzeXsnat8aODucV5zRVa6o7yChZ9je9&quot;,
      &quot;product_type&quot;: &quot;configurable&quot;,
      &quot;sku&quot;: &quot;032501-42&quot;,
      &quot;qty&quot;: 1,
      &quot;extension_attributes&quot;: {},
      &quot;product_option&quot;: {
        &quot;extension_attributes&quot;: {
          &quot;configurable_item_options&quot;: [
            {
              &quot;option_id&quot;: &quot;168&quot;,
              &quot;option_value&quot;: 278
            }
          ]
        }
      }
    }
  }
  </code></pre>
  <p>Response</p>
  <blockquote>
  <p>400 - Bad request</p>
  </blockquote>
  <hr />
  <p><strong>SECOND METHOD:</strong></p>
  <p>From <a href="https://magento.stackexchange.com/a/188469/58853">this answer</a> I learned that there should be an extra step in between because you have to use the actual quote id instead of the mask that is returned by <code>V1/guest-carts</code>. That changes the flow to the following.</p>
  <p><strong>Create a new guest cart</strong></p>
  <p>Request</p>
  <pre><code>POST: V1/guest-carts
  </code></pre>
  <p>Response:</p>
  <pre><code>&quot;EDzeXsnat8aODucV5zRVa6o7yChZ9je9&quot;
  </code></pre>
  <p><strong>Request quote id</strong></p>
  <p>Request</p>
  <pre><code>GET: V1/guest-carts/EDzeXsnat8aODucV5zRVa6o7yChZ9je9
  </code></pre>
  <p>Response</p>
  <pre><code>{
    &quot;id&quot;: 95563,
    // etc ...
  }
  </code></pre>
  <p><strong>Add product to guest cart</strong></p>
  <p>Request</p>
  <pre><code>POST: V1/guest-carts/95563/items
  
  {
    &quot;cart_item&quot;: {
      &quot;quote_id&quot;: &quot;95563&quot;,
      &quot;product_type&quot;: &quot;configurable&quot;,
      &quot;sku&quot;: &quot;032501-42&quot;,
      &quot;qty&quot;: 1,
      &quot;extension_attributes&quot;: {},
      &quot;product_option&quot;: {
        &quot;extension_attributes&quot;: {
          &quot;configurable_item_options&quot;: [
            {
              &quot;option_id&quot;: &quot;168&quot;,
              &quot;option_value&quot;: 278
            }
          ]
        }
      }
    }
  }
  </code></pre>
  <p>Response</p>
  <blockquote>
  <p>404 - No route found</p>
  </blockquote>