{
  "openapi": "3.1.0",
  "info": {
    "title": "Baara : API catalogue (clé machine)",
    "version": "1.0.0",
    "description": "Lecture du catalogue de votre organisation (catégories, produits). Authentification : en-tête X-Baara-Api-Key. Généré depuis service-catalog.",
    "x-genere-depuis": "0b4253dc"
  },
  "servers": [
    {
      "url": "https://api.baara-connect.com",
      "description": "Production (et espace de test : même hôte, clé baara_test_…)"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Baara-Api-Key"
      }
    },
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ProductResponse": {
        "properties": {
          "scope_type": {
            "type": "string",
            "title": "Scope Type",
            "default": "ORG_GLOBAL"
          },
          "store_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Store Id"
          },
          "selected_store_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Selected Store Ids"
          },
          "name": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "category_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category Id"
          },
          "price_xof": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 1000000000000000.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Price Xof",
            "description": "Unit price in whole XOF francs"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 3
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "external_ref": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "External Ref"
          },
          "is_active": {
            "type": "boolean",
            "title": "Is Active",
            "default": true
          },
          "stock_tracked": {
            "type": "boolean",
            "title": "Stock Tracked",
            "description": "Suivre le stock de ce produit dans Baara. Faux par défaut : la plupart des articles d'une petite boutique ne se comptent pas, et tout suivre produirait des alertes sur du sable. Passer à vrai n'invente aucune quantité — c'est un comptage physique qui initialise le stock.",
            "default": false
          },
          "low_stock_threshold": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 1000000000.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Low Stock Threshold",
            "description": "Seuil d'alerte de stock bas. Absent = pas d'alerte de seuil ; la rupture, elle, se signale toujours."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "organization_id": {
            "type": "string",
            "format": "uuid",
            "title": "Organization Id"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "name",
          "id",
          "organization_id",
          "created_at",
          "updated_at"
        ],
        "title": "ProductResponse",
        "description": "Product response schema."
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/api/v1/external/catalog/v1/products": {
      "get": {
        "tags": [
          "catalog-public-v1",
          "catalog-public-v1"
        ],
        "summary": "List Products Public",
        "operationId": "list_products_public_api_v1_external_catalog_v1_products_get",
        "parameters": [
          {
            "name": "category_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Category Id"
            }
          },
          {
            "name": "is_active",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Active"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "store_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional store filter (must be in JWT store_ids)",
              "title": "Store Id"
            },
            "description": "Optional store filter (must be in JWT store_ids)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProductResponse"
                  },
                  "title": "Response List Products Public Api V1 External Catalog V1 Products Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external/catalog/v1/products/{product_id}": {
      "get": {
        "tags": [
          "catalog-public-v1",
          "catalog-public-v1"
        ],
        "summary": "Get Product Public",
        "operationId": "get_product_public_api_v1_external_catalog_v1_products__product_id__get",
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Product Id"
            }
          },
          {
            "name": "store_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional store filter (must be in JWT store_ids)",
              "title": "Store Id"
            },
            "description": "Optional store filter (must be in JWT store_ids)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  }
}
