Invalid type specified in payload


When trying to add a product to a cart

my json code is as follow
{ "quantity": "2", "type": "cart_item", "id": "1121a4db-604b-4ba9-8f2e-15c77719209e" }

and the error I am getting is:
{ "errors": [ { "status": 400, "source": "request", "title": "Bad Request", "detail": "Invlaid type specified in payload." } ] }


Hey @handre

Your payload needs to be inside data.

So something like:

  "data": { "quantity": "2", "type": "cart_item", "id": "1121a4db-604b-4ba9-8f2e-15c77719209e" }

would work :slight_smile:

Let me know if that helps


Id must be the product ID correct?

{ "errors": [ { "status": 404, "title": "Product not found", "detail": "The requested product could not be found" } ] }


That is correct, you specify the card reference in the url /carts/{{cartRef}}/items and the product id in the request body.

Hope this helps


cartRef, must it be unique to each client or can it be a hard-coded reference?

Thanks in advance


the cart should have a unique reference id, if you use our SDK when a cart is created it will be assigned a unique id. If you are coding this yourself you will need to create a unique id for each created cart. Carts are destroyed 7 days after they were last updated.



Perfect that you very much!


hi @drew

I still get a 404 product not found error. I triple checked and the id is definitely an existing product and valid.


Hey @handre

This looks like it could use some further investigation. Could you raise an issue in our support portal at and provide the request you are making including the url and if you could also provide your store id (you can find that on the dashboard) that would be great.



Hi @handre

Is the product status you are adding set to live?


Hi @notrab

After changing the product to live it worked.

That’s great thank you very much.

Because I am still in development all of my test products are drafts. Maybe it can be nice to make it accessible for testing purposes?


Hey @handre

live and draft statuses on products make it easier when using the implicit authentication type, which is often used with frontend applications to get only the products that are public facing.

client_credentials allows you to get all products, regardless of their status.

I’m glad we could help, can’t wait to hear more about your project :smile:


Hi @notrab

I am using the client_credentials authentication? :thinking:

But all is working now, thanks once again.


Hi @notrab,

When I did my testing in postman, it works.
However now that I am actually doing it in my code, I get a 401 (Unauthorized) error?

I know the client_credentials token has not expires as I refreshed it before I tried.

Any suggestions?


Hi @handre

How are you setting the token in your code? Could we possibly take a look at your Auth call?




Hi Drew.

At the moment I am still manually calling through postman, then copying the token like shown below:
token = 'd5236e68ca0609cc6fef3cb9e3d9c948070aa1b7';
then using it as shown:

      { headers: new HttpHeaders().set('Authorization', 'Bearer ' + `${this.token}`).set('Content-Type', 'application/json') }


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.