Get Cart
curl --request GET \
--url https://your-store.launchmystore.io/cart.js \
--header 'Authorization: Bearer <token>'import requests
url = "https://your-store.launchmystore.io/cart.js"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://your-store.launchmystore.io/cart.js', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-store.launchmystore.io/cart.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-store.launchmystore.io/cart.js"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://your-store.launchmystore.io/cart.js")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-store.launchmystore.io/cart.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"token": "<string>",
"items": [
{
"key": "<string>",
"id": 123,
"variant_id": 123,
"product_id": 123,
"title": "<string>",
"variant_title": "<string>",
"quantity": 123,
"price": 123,
"line_price": 123,
"sku": "<string>",
"image": {},
"properties": {}
}
],
"item_count": 123,
"total_price": 123,
"currency": "<string>",
"requires_shipping": true,
"note": "<string>",
"attributes": {}
}Cart
Get Cart
Retrieve the current cart
GET
/
cart.js
Get Cart
curl --request GET \
--url https://your-store.launchmystore.io/cart.js \
--header 'Authorization: Bearer <token>'import requests
url = "https://your-store.launchmystore.io/cart.js"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://your-store.launchmystore.io/cart.js', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-store.launchmystore.io/cart.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-store.launchmystore.io/cart.js"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://your-store.launchmystore.io/cart.js")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-store.launchmystore.io/cart.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"token": "<string>",
"items": [
{
"key": "<string>",
"id": 123,
"variant_id": 123,
"product_id": 123,
"title": "<string>",
"variant_title": "<string>",
"quantity": 123,
"price": 123,
"line_price": 123,
"sku": "<string>",
"image": {},
"properties": {}
}
],
"item_count": 123,
"total_price": 123,
"currency": "<string>",
"requires_shipping": true,
"note": "<string>",
"attributes": {}
}Get Cart
Returns the current cart for the visitor.The cart is a storefront surface, not part of the OAuth
/api/v1 app
API. It follows the AJAX cart contract: requests are made against the
storefront origin (your store domain), identity is the cart cookie token
(not a Bearer access token), and the response is the flat cart
object — not wrapped in a { status, type, data } envelope.Request
GET /cart.js returns the current cart as JSON. The cart is identified by
the cart cookie that the storefront sets on the first write action; send it
with the request (browsers do this automatically).
curl -X GET "https://your-store.launchmystore.io/cart.js" \
-H "Cookie: cart=c1-xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
const response = await fetch('/cart.js', {
headers: { 'Accept': 'application/json' }
});
const cart = await response.json();
Response
The response is the flat cart object. Money fields are integers in the store’s currency subunit (e.g. cents).string
Unique cart token (matches the
cart cookie)array
Array of line items
Show Line Item
Show Line Item
string
Line item key (
{variant_id}:{hash} — used to target this line)integer
Variant ID
integer
Variant ID
integer
Product ID
string
Product title
string
Variant title
integer
Quantity
integer
Price per item in the currency subunit
integer
Total line price in the currency subunit
string
SKU
object
Product image
object
Custom line item properties (key-value object)
integer
Total number of items
integer
Cart total in the currency subunit
string
Currency code
boolean
Whether any items require shipping
string
Cart note
object
Cart attributes (key-value pairs)
Example Response
{
"token": "c1-9a3f0c2e-7b1d-4e8a-9f2c-1a2b3c4d5e6f",
"items": [
{
"key": "639664:default",
"id": 639664,
"product_id": 12001,
"variant_id": 639664,
"title": "Classic T-Shirt",
"variant_title": "Medium / Black",
"quantity": 2,
"price": 2500,
"line_price": 5000,
"sku": "TSHIRT-M-BLK",
"image": {
"src": "https://assets.launchmystore.io/images/tshirt-black.jpg",
"alt": "Black T-Shirt"
},
"properties": {},
"requires_shipping": true,
"taxable": true
},
{
"key": "640001:7c1f9a2b3d4e",
"id": 640001,
"product_id": 12044,
"variant_id": 640001,
"title": "Baseball Cap",
"variant_title": "One Size / Navy",
"quantity": 1,
"price": 1500,
"line_price": 1500,
"sku": "CAP-NAVY",
"image": {
"src": "https://assets.launchmystore.io/images/cap-navy.jpg",
"alt": "Navy Baseball Cap"
},
"properties": {
"Personalization": "John"
},
"requires_shipping": true,
"taxable": true
}
],
"item_count": 3,
"total_price": 6500,
"currency": "USD",
"requires_shipping": true,
"note": "",
"attributes": {}
}
item_count: 0 with an empty items array.
Errors
If the store context cannot be resolved, the endpoint returns a standard error body with the real HTTP status:{
"status": 400,
"message": "Store context not found.",
"description": "Missing store identifier"
}