{
  "info": {
    "name": "AIAsistent",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "AIAsistent API. Set tenantKey and adminKey on the collection variables. Keep both keys server-side only."
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://localhost:8080"
    },
    {
      "key": "tenantKey",
      "value": ""
    },
    {
      "key": "adminKey",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Admin",
      "item": [
        {
          "name": "Create tenant",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-Admin-Key",
                "value": "{{adminKey}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/admin/tenants",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "admin",
                "tenants"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Acme Shop\",\n  \"monthlyRequestLimit\": 20000\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Create key (returned once)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-Admin-Key",
                "value": "{{adminKey}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/admin/tenants/:tenantId/keys",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "admin",
                "tenants",
                ":tenantId",
                "keys"
              ],
              "variable": [
                {
                  "key": "tenantId",
                  "value": ""
                }
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"backend production\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Create test key",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-Admin-Key",
                "value": "{{adminKey}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/admin/tenants/:tenantId/keys",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "admin",
                "tenants",
                ":tenantId",
                "keys"
              ],
              "variable": [
                {
                  "key": "tenantId",
                  "value": ""
                }
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"integration test\",\n  \"test\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "List keys",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-Admin-Key",
                "value": "{{adminKey}}"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/admin/tenants/:tenantId/keys",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "admin",
                "tenants",
                ":tenantId",
                "keys"
              ],
              "variable": [
                {
                  "key": "tenantId",
                  "value": ""
                }
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Revoke key",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "X-Admin-Key",
                "value": "{{adminKey}}"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/admin/tenants/:tenantId/keys/:keyId",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "admin",
                "tenants",
                ":tenantId",
                "keys",
                ":keyId"
              ],
              "variable": [
                {
                  "key": "tenantId",
                  "value": ""
                },
                {
                  "key": "keyId",
                  "value": ""
                }
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Disable tenant",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "X-Admin-Key",
                "value": "{{adminKey}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/admin/tenants/:tenantId",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "admin",
                "tenants",
                ":tenantId"
              ],
              "variable": [
                {
                  "key": "tenantId",
                  "value": ""
                }
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"enabled\": false\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    },
    {
      "name": "Tenant",
      "item": [
        {
          "name": "Usage",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/usage",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "usage"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{tenantKey}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "Interpretation (products)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/interpretations",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "interpretations"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{tenantKey}}",
                  "type": "string"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"question\": \"Do you have a tent under 3000 CZK in stock?\",\n  \"context\": {\n    \"currency\": \"CZK\"\n  },\n  \"fields\": [\n    {\n      \"name\": \"category\",\n      \"type\": \"string\",\n      \"description\": \"Product category.\",\n      \"required\": true,\n      \"allowedValues\": [\n        \"outdoor\",\n        \"books\"\n      ]\n    },\n    {\n      \"name\": \"maxPrice\",\n      \"type\": \"integer\",\n      \"description\": \"Maximum price in CZK.\",\n      \"required\": false\n    },\n    {\n      \"name\": \"inStock\",\n      \"type\": \"boolean\",\n      \"description\": \"Only items in stock.\",\n      \"required\": false\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Answer (products)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/answers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "answers"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{tenantKey}}",
                  "type": "string"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"question\": \"Do you have a tent under 3000 CZK in stock?\",\n  \"sources\": [\n    {\n      \"id\": \"tent\",\n      \"title\": \"Family tent\",\n      \"text\": \"Family tent: Four-person tent for family trips. Price 2490 CZK.\",\n      \"url\": \"https://shop.example/products/tent\",\n      \"updatedAt\": \"2026-09-30T08:00:00+00:00\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Answer (empty sources, no model call)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/answers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "answers"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{tenantKey}}",
                  "type": "string"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"question\": \"Do you have a tent under 3000 CZK in stock?\",\n  \"sources\": []\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    },
    {
      "name": "Health",
      "item": [
        {
          "name": "Live",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/health/live",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "health",
                "live"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Ready",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/health/ready",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "health",
                "ready"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "OpenAPI",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/openapi/v1.json",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "openapi",
                "v1.json"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        }
      ]
    }
  ]
}