Skip to content

Create a cart (optionally with lines)

POST/store/v1/carts
  • Idempotency-Key supported

Create a cart (optionally with lines). Send X-Customer-Token to link a signed-in customer. The response carries the cart token: send it as X-Cart-Token on every cart request; and the cart's checkout_url, the hosted checkout to send the shopper to.

Headers

  • X-Customer-Tokenstring · or null

    Customer session token

  • Idempotency-Keystring

    Send the same key to retry safely: the first answer is replayed for 24 hours.

  • shop-api-versionYYYY-MM

    The version to answer in. Without it, your app’s pinned version, else the newest.

Body

  • linesarray of objects
  • emailstring · or null
  • localestring · or null

    The shopper's language for emails, e.g. ar or en. Defaults to the store's.

  • countrystring · or null

    The country the storefront shows, e.g. AE: the cart prices in its market (currency and prices) until it has a shipping address. Defaults to the primary market.

Returns

201 Cart created.

Errors

  • 401unauthenticatedInvalid customer session.
  • 422validation_failedInvalid lines, email or locale.