API ReferenceCart
Add a menu item to the cart (or increment quantity).
Authorization
bearerAuth AuthorizationBearer <token>
AdonisJS access-token guard (middleware.auth({ guards: ["api"] })). Send Authorization: Bearer <oat_…> (issued by /auth/register, /auth/login, /auth/social/{google,apple}, or /auth/guest).
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/v1/cart/items" \ -H "Content-Type: application/json" \ -d '{ "menuItemId": "mit_01jq8zc1a3c5e7g9j1l3n5p7q9", "quantity": 1, "additionIds": [ "mia_01jq8za1a3c5e7g9j1l3n5p7q9" ], "notes": "No pickles please." }'{ "data": { "cart": { "id": "crt_01jq8zg1a3c5e7g9j1l3n5p7q9", "userId": "usr_01jq8z4b2k6h7n8m9p0r3s5t7v", "truckId": "trk_01jq8z2hf5t8z4w9d8x4mzg2p3", "currencyCode": "SAR", "subtotalMinor": 4700, "totalMinor": 4700, "items": [ { "id": "cli_01jq8zh1a3c5e7g9j1l3n5p7q9", "menuItemId": "mit_01jq8zc1a3c5e7g9j1l3n5p7q9", "nameSnapshot": "Smash Double", "descriptionSnapshot": "Two smashed beef patties, american cheese, house sauce.", "imageSnapshot": null, "unitPriceMinor": 3500, "currencyCode": "SAR", "quantity": 1, "lineTotalMinor": 3500, "selectedAdditions": [ { "id": "mia_01jq8za1a3c5e7g9j1l3n5p7q9", "name": "Cheese", "priceMinor": 300 } ], "notes": "No pickles please." }, { "id": "cli_01jq8zh2b4d6f8h0k2m4o6q8s0", "menuItemId": "mit_01jq8zc2b4d6f8h0k2m4o6q8s0", "nameSnapshot": "Turkish Coffee", "descriptionSnapshot": "Hand-brewed mehmet efendi blend.", "imageSnapshot": null, "unitPriceMinor": 1200, "currencyCode": "SAR", "quantity": 1, "lineTotalMinor": 1200, "selectedAdditions": [], "notes": null } ] } }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "VALIDATION_ERROR", "message": "Request body is malformed." }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "AUTH_REQUIRED", "message": "Authentication is required to access this resource." }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "CONFLICT", "message": "This action conflicts with an existing record.", "targetType": "order", "targetId": "ord_01jq8z3a0n0y9v0x1g4t2c7m6e" }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "VALIDATION_ERROR", "message": "One or more fields are invalid.", "fields": [ { "path": "email", "rule": "email", "message": "Must be a valid email address." } ] }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}