Skip to main content
POST
/
api
/
v2
/
storefront
/
wishlists
Create a Wishlist
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({name: 'My Wishlist', is_private: false, is_default: true})
};

fetch('https://demo.spreecommerce.org/api/v2/storefront/wishlists', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "data": {
    "id": "28",
    "type": "wishlist",
    "attributes": {
      "token": "1inBHcJnxBrVEMAZb9esRqZP",
      "name": "My Wishlist",
      "is_private": false,
      "is_default": true,
      "variant_included": false
    },
    "relationships": {
      "wished_items": {
        "data": [
          {
            "id": "14",
            "type": "wished_item"
          }
        ]
      }
    }
  }
}

Authorizations

Authorization
string
header
required

User token to authorize Cart and Checkout requests.

It is required to associate Cart with the User.

Query Parameters

fields[wishlist]
string

Specify the fields you would like returned in the response body. More information.

Body

application/json
name
string
required

The Wishlist name.

is_private
boolean

Set the Wishlist to public or private. Defaults to true (private).

is_default
boolean

Whether the wishlist is set to the users default wishlist for the current store. Defaults to false.

Response

200 Success - Returns the wishlist object.

data
Wishlist · object
required
included
Wishlist Includes · object[]