{"components":{"parameters":{"ItemId":{"description":"Item id.","in":"path","name":"itemId","required":true,"schema":{"type":"string"}},"ListId":{"description":"List id.","in":"path","name":"id","required":true,"schema":{"type":"string"}}},"responses":{"BadRequest":{"content":{"application/json":{"example":{"error":"bad_request","message":"Item text is required."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Request body is invalid."},"ItemNotFound":{"content":{"application/json":{"example":{"error":"not_found","message":"Item not found."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Item not found in this list."},"ListNotFound":{"content":{"application/json":{"example":{"error":"not_found","message":"List not found."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"List not found."},"Unauthorized":{"content":{"application/json":{"example":{"error":"unauthorized","message":"Missing or invalid X-API-Key header."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Missing or invalid X-API-Key header."}},"schemas":{"Category":{"properties":{"id":{"type":"string"},"name":{"description":"Category name, e.g. מוצרי חלב.","type":"string"},"position":{"type":"integer"}},"required":["id","name","position"],"type":"object"},"Error":{"properties":{"error":{"description":"Machine-readable error code.","enum":["unauthorized","bad_request","not_found","internal_error","service_unavailable","forbidden"],"type":"string"},"message":{"description":"Human-readable error message.","type":"string"}},"required":["error","message"],"type":"object"},"Item":{"properties":{"barcode":{"description":"Preferred exact product barcode (מק״ט). Null when none. When set, compare this exact product by barcode, not by name.","type":["string","null"]},"categoryId":{"type":"string"},"checked":{"description":"True when the item was bought (checked).","type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"description":"Session user id for web adds, api-key:<keyId> for API adds.","type":["string","null"]},"id":{"type":"string"},"position":{"type":"integer"},"quantity":{"description":"Quantity, e.g. 2. Null when not set.","type":["number","null"]},"text":{"description":"Product name, e.g. חלב.","type":"string"},"unit":{"description":"Unit, e.g. ליטר. Null when not set.","type":["string","null"]},"updatedAt":{"format":"date-time","type":"string"},"icon":{"description":"Per-item emoji override chosen in the edit page. Null = automatic icon from the product mapping.","type":["string","null"]},"note":{"description":"Short note shown under the item name (e.g. a preferred brand). Null when none.","type":["string","null"]}},"required":["id","text","checked","quantity","unit","barcode","categoryId","position","createdBy","createdAt","updatedAt","icon","note"],"type":"object"},"ItemPatch":{"description":"Only the fields present are updated. At least one field (or checked) must be present, otherwise 400.","properties":{"barcode":{"description":"Barcode (max 64 characters), or null to clear.","type":["string","null"]},"categoryId":{"description":"Id of a category available to this list (the list's own category set). Moving an item also teaches your product dictionary (shopping lists only).","type":"string"},"checked":{"description":"True = bought (checked), false = not bought.","type":"boolean"},"quantity":{"description":"Positive number, or null to clear.","type":["number","null"]},"text":{"description":"New product name (non-empty).","type":"string"},"unit":{"description":"Unit, or null to clear.","type":["string","null"]},"icon":{"description":"A single emoji as the per-item icon override, or null to go back to the automatic icon. Anything else is rejected with 400.","type":["string","null"]},"note":{"description":"Short note (max 200 characters), or null to clear.","type":["string","null"]}},"type":"object"},"ItemWithCategory":{"allOf":[{"$ref":"#/components/schemas/Item"},{"properties":{"categoryName":{"description":"Name of the item's category. Null when the category was not part of this response (PATCH without a category change returns null here).","type":["string","null"]}},"type":"object"}]},"ListDetail":{"properties":{"categories":{"items":{"$ref":"#/components/schemas/Category"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"emoji":{"type":"string"},"hideCompleted":{"type":"boolean"},"id":{"type":"string"},"items":{"items":{"$ref":"#/components/schemas/Item"},"type":"array"},"position":{"type":"integer"},"title":{"type":"string"},"totalCount":{"type":"integer"},"type":{"$ref":"#/components/schemas/ListType"},"uncheckedCount":{"type":"integer"}},"required":["id","title","emoji","type","hideCompleted","position","createdAt","categories","items","totalCount","uncheckedCount"],"type":"object"},"ListSummary":{"properties":{"emoji":{"description":"List emoji.","type":"string"},"id":{"description":"List id.","type":"string"},"title":{"description":"List title.","type":"string"},"totalCount":{"description":"Total items in the list.","type":"integer"},"type":{"$ref":"#/components/schemas/ListType"},"uncheckedCount":{"description":"Items not yet checked (bought).","type":"integer"},"role":{"description":"The key owner's role in this list.","enum":["owner","member"],"type":"string"}},"required":["id","title","emoji","type","totalCount","uncheckedCount","role"],"type":"object"},"ListType":{"description":"shopping = קניות, todo = משימות, packing = אריזה לחו״ל, generic = רשימה כללית.","enum":["shopping","todo","packing","generic"],"type":"string"},"MoveBody":{"properties":{"categoryId":{"description":"Id of a category available to this list (the list's own category set). Moving an item also teaches your product dictionary (shopping lists only).","type":"string"}},"required":["categoryId"],"type":"object"},"NewItem":{"properties":{"barcode":{"description":"Preferred exact product barcode (מק״ט). Empty strings are stored as null.","type":"string"},"quantity":{"description":"Quantity. Non-number values are stored as null.","type":"number"},"text":{"description":"Product name (required, non-empty). The item is auto-categorized: your product dictionary first (exact match, then longest word-prefix match), then the generic dictionary the same way, then the Open Food Facts categories_tags in offCategories, else אחר. Auto-categorization applies to shopping lists only; other list types always land in אחר.","type":"string"},"unit":{"description":"Unit, e.g. ליטר. Empty strings are stored as null.","type":"string"},"icon":{"description":"A single emoji as the per-item icon override. Empty strings are stored as null.","type":"string"},"note":{"description":"Short note shown under the item name. Empty strings are stored as null.","type":"string"},"offCategories":{"type":"array","items":{"type":"string"},"description":"Open Food Facts categories_tags for a scanned product (e.g. [\"en:spreads\", \"en:chocolate-spreads\"]). Used only when the name matches neither dictionary: the tags map to a category name, and the item lands there only if the list already has such a shopping category — categories are never created from tags. Unmapped tags, or a mapped name the list lacks, fall back to אחר."}},"required":["text"],"type":"object"}},"securitySchemes":{"ApiKeyAuth":{"description":"Personal API key (starts with ak_live_...). Shown once at creation. The key belongs to the user and works in every list they participate in, subject to each list's agent-access setting (none / read / write, set by the list owner).","in":"header","name":"X-API-Key","type":"apiKey"}}},"info":{"description":"REST API for the AIList shopping lists. Every request authenticates with the user's personal API key in the X-API-Key header (create the key in the app settings under My API keys). The key works in every list the user participates in, subject to each list's agent-access setting; API access requires a Pro subscription. Unchecked items are the ones still to buy.","title":"AIList API","version":"1.0.0"},"openapi":"3.0.3","paths":{"/lists":{"get":{"description":"Lists the key owner participates in, with item counts. Each list includes the key owner's role (owner or member). Lists whose agent access is 'none' are not listed.","operationId":"listLists","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ListSummary"},"type":"array"}}},"description":"Lists."},"401":{"$ref":"#/components/responses/Unauthorized"}},"summary":"List the user's lists","tags":["Lists"]}},"/lists/{id}":{"get":{"description":"Full list detail: categories and items. The web UI's product dictionary (autocomplete) is not part of the agent API and is not returned. ?checked=false returns only the items still to buy (unchecked); ?checked=true only the bought ones. totalCount/uncheckedCount always describe the whole list.","operationId":"getList","parameters":[{"$ref":"#/components/parameters/ListId"},{"description":"Filter items by checked state: false = still to buy, true = already bought. Omit for all items.","in":"query","name":"checked","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDetail"}}},"description":"List detail."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/ListNotFound"}},"summary":"Get one list with categories and items","tags":["Lists"]}},"/lists/{id}/categories":{"get":{"operationId":"listCategories","parameters":[{"$ref":"#/components/parameters/ListId"}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Category"},"type":"array"}}},"description":"Categories."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/ListNotFound"}},"summary":"List the categories of a list (private to this list)","tags":["Lists"]}},"/lists/{id}/items":{"post":{"description":"Adds an item to the list. The item is auto-categorized (your product dictionary, then generic dictionary, then the Open Food Facts categories_tags in offCategories, else אחר) in shopping lists only; other list types always land in אחר. The response includes the assigned category name.","operationId":"addItem","parameters":[{"$ref":"#/components/parameters/ListId"}],"requestBody":{"content":{"application/json":{"example":{"quantity":2,"text":"חלב","unit":"ליטר"},"schema":{"$ref":"#/components/schemas/NewItem"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemWithCategory"}}},"description":"Item created."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/ListNotFound"}},"summary":"Add an item","tags":["Items"]}},"/lists/{id}/items/{itemId}":{"delete":{"operationId":"deleteItem","parameters":[{"$ref":"#/components/parameters/ListId"},{"$ref":"#/components/parameters/ItemId"}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"example":true,"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"Item deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/ItemNotFound"}},"summary":"Delete an item","tags":["Items"]},"get":{"operationId":"getItem","parameters":[{"$ref":"#/components/parameters/ListId"},{"$ref":"#/components/parameters/ItemId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Item"}}},"description":"Item."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/ItemNotFound"}},"summary":"Get one item","tags":["Items"]},"patch":{"description":"Updates only the fields present in the body. Set checked to mark the item bought (true) or not bought (false). Changing categoryId also teaches your product dictionary (shopping lists only). Returns the updated item; categoryName is set only when categoryId was changed, otherwise null.","operationId":"updateItem","parameters":[{"$ref":"#/components/parameters/ListId"},{"$ref":"#/components/parameters/ItemId"}],"requestBody":{"content":{"application/json":{"example":{"checked":true},"schema":{"$ref":"#/components/schemas/ItemPatch"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemWithCategory"}}},"description":"Updated item."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"content":{"application/json":{"examples":{"category":{"value":{"error":"not_found","message":"Category not found in this list."}},"item":{"value":{"error":"not_found","message":"Item not found."}},"list":{"value":{"error":"not_found","message":"List not found."}}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"List, item, or category not found."}},"summary":"Edit an item and/or toggle its checked state","tags":["Items"]}},"/lists/{id}/items/{itemId}/check":{"post":{"operationId":"checkItem","parameters":[{"$ref":"#/components/parameters/ListId"},{"$ref":"#/components/parameters/ItemId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Item"}}},"description":"Updated item."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/ItemNotFound"}},"summary":"Mark an item as bought (checked)","tags":["Items"]}},"/lists/{id}/items/{itemId}/move":{"post":{"description":"Moves the item to the given category (must belong to this list's type set). Also teaches your product dictionary (shopping lists only), so the same product is categorized the same way next time.","operationId":"moveItem","parameters":[{"$ref":"#/components/parameters/ListId"},{"$ref":"#/components/parameters/ItemId"}],"requestBody":{"content":{"application/json":{"example":{"categoryId":"abc123"},"schema":{"$ref":"#/components/schemas/MoveBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemWithCategory"}}},"description":"Moved item."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"content":{"application/json":{"examples":{"category":{"value":{"error":"not_found","message":"Category not found in this list."}},"item":{"value":{"error":"not_found","message":"Item not found."}},"list":{"value":{"error":"not_found","message":"List not found."}}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"List, item, or category not found."}},"summary":"Move an item to another category","tags":["Items"]}},"/lists/{id}/items/{itemId}/uncheck":{"post":{"operationId":"uncheckItem","parameters":[{"$ref":"#/components/parameters/ListId"},{"$ref":"#/components/parameters/ItemId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Item"}}},"description":"Updated item."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/ItemNotFound"}},"summary":"Mark an item as not bought (unchecked)","tags":["Items"]}}},"security":[{"ApiKeyAuth":[]}],"servers":[{"description":"Production","url":"https://ai-list.web.app/api/v1"}],"tags":[{"description":"Read lists and their categories and items.","name":"Lists"},{"description":"Add, read, edit, check and move items.","name":"Items"}]}