get-cart
Method: GET
Path: /carts/{id}
Tags: Carts
Summary
Retrieve cart detail
Description
Retrieves the full Cart object for the given cart ID.
Storefront SDK Usage
SDK Method: sdk.cart.getCart()
Example:
typescript
const { data, error } = await sdk.cart.getCart({
id: "01H9CART12345ABCDE"
});
if (error) {
console.error("Failed to get cart:", error.message);
} else {
const cart = data.cart;
console.log("Cart total:", cart.grand_total);
console.log("Items count:", cart.cart_items.length);
}TypeScript Definition
typescript
"get-cart": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Cart ID */
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @example cart details */
message: $Read<string>;
success: $Read<boolean>;
content: {
cart: components["schemas"]["CartRead"];
};
};
};
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["CartRead"] | CartRead |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["NotFound"] | NotFound |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- id (path): Cart ID
Responses
200
OK
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
404
Requested resource not found
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
json
{
"tags": [
"Carts"
],
"operationId": "get-cart",
"summary": "Retrieve cart detail",
"description": "Retrieves the full `Cart` object for the given cart ID.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/get-cart",
"description": "API reference for the get-cart operation"
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "Cart ID",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string",
"examples": [
"cart details"
],
"readOnly": true
},
"success": {
"type": "boolean",
"readOnly": true
},
"content": {
"properties": {
"cart": {
"$ref": "#/components/schemas/CartRead"
}
},
"required": [
"cart"
],
"type": "object"
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "carts",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "getCart"
}Auto-generated from OpenAPI spec and TypeScript definitions