{
  "info": {
    "name": "Athena API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Auto-generated Postman collection for all registered Athena RS routes."
  },
  "variable": [
    { "key": "baseUrl", "value": "http://localhost:4052", "type": "string" },
    { "key": "X_User_Id", "value": "", "type": "string" },
    { "key": "X_Company_Id", "value": "", "type": "string" },
    { "key": "X_Organization_Id", "value": "", "type": "string" },
    { "key": "X_Athena_Client", "value": "supabase", "type": "string" },
    { "key": "X_Strip_Nulls", "value": "false", "type": "string" },
    { "key": "X_Publish_Event", "value": "false", "type": "string" },
    { "key": "apikey", "value": "", "type": "string" },
    { "key": "api_registry_id", "value": "", "type": "string" },
    { "key": "scylla_table_name", "value": "users", "type": "string" },
    { "key": "x_supabase_url", "value": "", "type": "string" },
    { "key": "x_supabase_key", "value": "", "type": "string" },
    { "key": "SUPABASE_ACCESS_TOKEN", "value": "", "type": "string" },
    { "key": "PROJECT_REF", "value": "", "type": "string" },
    { "key": "api_key_id", "value": "", "type": "string" },
    { "key": "api_key_right_id", "value": "", "type": "string" },
    { "key": "admin_client_name", "value": "", "type": "string" }
  ],
  "item": [
    {
      "name": "Health",
      "item": [
        {
          "name": "GET /",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/"
          }
        },
        {
          "name": "GET /ping",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "text/plain" }],
            "url": "{{baseUrl}}/ping"
          }
        }
      ]
    },
    {
      "name": "Scylla",
      "item": [
        {
          "name": "GET /scylla",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/scylla"
          }
        },
        {
          "name": "GET /scylla/tables",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/scylla/tables"
          }
        },
        {
          "name": "GET /scylla/columns",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/scylla/columns?table_name={{scylla_table_name}}",
              "query": [
                { "key": "table_name", "value": "{{scylla_table_name}}" }
              ]
            }
          }
        },
        {
          "name": "GET /scylla/list_tables",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/scylla/list_tables"
          }
        }
      ]
    },
    {
      "name": "Query",
      "item": [
        {
          "name": "POST /query/sql",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"query\": \"select 1 as col\",\n  \"driver\": \"postgresql\",\n  \"db_name\": \"example_db\"\n}"
            },
            "url": "{{baseUrl}}/query/sql"
          }
        }
      ]
    },
    {
      "name": "Gateway /fetch and /data",
      "item": [
        {
          "name": "POST /gateway/fetch",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "X-User-Id", "value": "{{X_User_Id}}" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" },
              { "key": "X-Strip-Nulls", "value": "{{X_Strip_Nulls}}" },
              { "key": "apikey", "value": "{{apikey}}" },
              { "key": "x-supabase-url", "value": "{{x_supabase_url}}" },
              { "key": "x-supabase-key", "value": "{{x_supabase_key}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"view_name\": \"invoices_view\",\n  \"columns\": [\"*\"],\n  \"conditions\": [\n    { \"eq_column\": \"company_id\", \"eq_value\": \"{{X_Company_Id}}\" }\n  ],\n  \"limit\": 100,\n  \"current_page\": 1,\n  \"page_size\": 100,\n  \"offset\": 0,\n  \"total_pages\": 1,\n  \"strip_nulls\": false\n}"
            },
            "url": "{{baseUrl}}/gateway/fetch"
          }
        },
        {
          "name": "GET /data",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-User-Id", "value": "{{X_User_Id}}" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" },
              { "key": "X-Strip-Nulls", "value": "{{X_Strip_Nulls}}" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": {
              "raw": "{{baseUrl}}/data?view=invoices_view&eq_column=company_id&eq_value={{X_Company_Id}}&columns=*&limit=100&current_page=1&page_size=100&offset=0&total_pages=1&strip_nulls=false",
              "query": [
                { "key": "view", "value": "invoices_view" },
                { "key": "eq_column", "value": "company_id" },
                { "key": "eq_value", "value": "{{X_Company_Id}}" },
                { "key": "columns", "value": "*" },
                { "key": "limit", "value": "100" },
                { "key": "current_page", "value": "1" },
                { "key": "page_size", "value": "100" },
                { "key": "offset", "value": "0" },
                { "key": "total_pages", "value": "1" },
                { "key": "strip_nulls", "value": "false" }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Gateway /insert and /delete",
      "item": [
        {
          "name": "PUT /gateway/insert",
          "request": {
            "method": "PUT",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "X-User-Id", "value": "{{X_User_Id}}" },
              { "key": "X-Company-Id", "value": "{{X_Company_Id}}" },
              { "key": "X-Organization-Id", "value": "{{X_Organization_Id}}" },
              { "key": "X-Publish-Event", "value": "{{X_Publish_Event}}" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"table_name\": \"invoices\",\n  \"insert_body\": {\n    \"company_id\": \"{{X_Company_Id}}\",\n    \"amount\": 123.45,\n    \"status\": \"draft\"\n  },\n  \"update_body\": {\n    \"status\": \"sent\"\n  }\n}"
            },
            "url": "{{baseUrl}}/gateway/insert"
          }
        },
        {
          "name": "DELETE /gateway/delete",
          "request": {
            "method": "DELETE",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "X-User-Id", "value": "{{X_User_Id}}" },
              { "key": "X-Company-Id", "value": "{{X_Company_Id}}" },
              { "key": "X-Organization-Id", "value": "{{X_Organization_Id}}" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" },
              { "key": "apikey", "value": "{{apikey}}" },
              { "key": "x-supabase-url", "value": "{{x_supabase_url}}" },
              { "key": "x-supabase-key", "value": "{{x_supabase_key}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"table_name\": \"invoices\",\n  \"resource_id\": \"<resource-uuid>\"\n}"
            },
            "url": "{{baseUrl}}/gateway/delete"
          }
        }
      ]
    },
    {
      "name": "Gateway /update and /query",
      "item": [
        {
          "name": "POST /gateway/update",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "X-User-Id", "value": "{{X_User_Id}}" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" },
              { "key": "X-Strip-Nulls", "value": "{{X_Strip_Nulls}}" },
              { "key": "apikey", "value": "{{apikey}}" },
              { "key": "x-api-key", "value": "{{apikey}}" },
              { "key": "x-supabase-url", "value": "{{x_supabase_url}}" },
              { "key": "x-supabase-key", "value": "{{x_supabase_key}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"table_name\": \"invoices\",\n  \"columns\": [\"status\", \"amount\"],\n  \"conditions\": [\n    { \"eq_column\": \"company_id\", \"eq_value\": \"{{X_Company_Id}}\" }\n  ],\n  \"limit\": 50\n}"
            },
            "url": "{{baseUrl}}/gateway/update"
          }
        },
        {
          "name": "POST /gateway/query",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"query\": \"SELECT status, SUM(amount) FROM invoices WHERE company_id = '{{X_Company_Id}}' GROUP BY status\"\n}"
            },
            "url": "{{baseUrl}}/gateway/query"
          }
        }
      ]
    },
    {
      "name": "Pipeline",
      "item": [
        {
          "name": "POST /pipelines",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pipeline\": \"example_copy\",\n  \"source\": {\n    \"table_name\": \"users\",\n    \"columns\": [\"id\", \"email\"],\n    \"conditions\": []\n  },\n  \"transform\": {\n    \"group_by\": \"region\",\n    \"aggregation_column\": \"score\",\n    \"aggregation_strategy\": \"cumulative_sum\"\n  },\n  \"sink\": {\n    \"table_name\": \"users_backup\"\n  }\n}"
            },
            "url": "{{baseUrl}}/pipelines"
          }
        }
      ]
    },
    {
      "name": "Registry",
      "item": [
        {
          "name": "GET /router/registry",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/router/registry"
          }
        },
        {
          "name": "GET /registry",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/registry"
          }
        },
        {
          "name": "GET /registry/{api_registry_id}",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/registry/{{api_registry_id}}"
          }
        }
      ]
    },
    {
      "name": "Schema",
      "item": [
        {
          "name": "GET /schema/clients",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/schema/clients"
          }
        },
        {
          "name": "GET /clients",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/clients"
          }
        },
        {
          "name": "GET /schema/tables",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" }
            ],
            "url": "{{baseUrl}}/schema/tables"
          }
        },
        {
          "name": "GET /schema/columns",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" }
            ],
            "url": {
              "raw": "{{baseUrl}}/schema/columns?table_name=invoices",
              "query": [{ "key": "table_name", "value": "invoices" }]
            }
          }
        },
        {
          "name": "GET /schema/migrations",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Athena-Client", "value": "{{X_Athena_Client}}" }
            ],
            "url": "{{baseUrl}}/schema/migrations"
          }
        }
      ]
    },
    {
      "name": "Supabase",
      "item": [
        {
          "name": "POST /api/v2/supabase/ssl_enforcement",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"enabled\": true,\n  \"access_token\": \"{{SUPABASE_ACCESS_TOKEN}}\",\n  \"project_ref\": \"{{PROJECT_REF}}\"\n}"
            },
            "url": "{{baseUrl}}/api/v2/supabase/ssl_enforcement"
          }
        }
      ]
    },
    {
      "name": "Metrics",
      "item": [
        {
          "name": "GET /metrics",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "text/plain" }],
            "url": "{{baseUrl}}/metrics"
          }
        }
      ]
    },
    {
      "name": "Admin API Keys",
      "item": [
        {
          "name": "GET /admin/api-keys",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/admin/api-keys"
          }
        },
        {
          "name": "POST /admin/api-keys",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"importer\",\n  \"description\": \"readonly key\",\n  \"client_name\": \"{{admin_client_name}}\",\n  \"rights\": [\"read_reports\"]\n}"
            },
            "url": "{{baseUrl}}/admin/api-keys"
          }
        },
        {
          "name": "PATCH /admin/api-keys/{id}",
          "request": {
            "method": "PATCH",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"importer\",\n  \"description\": \"updated key\",\n  \"is_active\": true\n}"
            },
            "url": "{{baseUrl}}/admin/api-keys/{{api_key_id}}"
          }
        },
        {
          "name": "DELETE /admin/api-keys/{id}",
          "request": {
            "method": "DELETE",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/admin/api-keys/{{api_key_id}}"
          }
        }
      ]
    },
    {
      "name": "Admin API Key Rights",
      "item": [
        {
          "name": "GET /admin/api-key-rights",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/admin/api-key-rights"
          }
        },
        {
          "name": "POST /admin/api-key-rights",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"read_reports\",\n  \"description\": \"Read-only access to reports\"\n}"
            },
            "url": "{{baseUrl}}/admin/api-key-rights"
          }
        },
        {
          "name": "PATCH /admin/api-key-rights/{id}",
          "request": {
            "method": "PATCH",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"description\": \"Updated description\"\n}"
            },
            "url": "{{baseUrl}}/admin/api-key-rights/{{api_key_right_id}}"
          }
        },
        {
          "name": "DELETE /admin/api-key-rights/{id}",
          "request": {
            "method": "DELETE",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/admin/api-key-rights/{{api_key_right_id}}"
          }
        }
      ]
    },
    {
      "name": "Admin API Key Config",
      "item": [
        {
          "name": "GET /admin/api-key-config",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/admin/api-key-config"
          }
        },
        {
          "name": "PUT /admin/api-key-config",
          "request": {
            "method": "PUT",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"enforce_api_keys\": true\n}"
            },
            "url": "{{baseUrl}}/admin/api-key-config"
          }
        }
      ]
    },
    {
      "name": "Admin API Key Clients",
      "item": [
        {
          "name": "GET /admin/api-key-clients",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/admin/api-key-clients"
          }
        },
        {
          "name": "PUT /admin/api-key-clients/{client_name}",
          "request": {
            "method": "PUT",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"enforce_api_keys\": false\n}"
            },
            "url": "{{baseUrl}}/admin/api-key-clients/{{admin_client_name}}"
          }
        },
        {
          "name": "DELETE /admin/api-key-clients/{client_name}",
          "request": {
            "method": "DELETE",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "apikey", "value": "{{apikey}}" }
            ],
            "url": "{{baseUrl}}/admin/api-key-clients/{{admin_client_name}}"
          }
        }
      ]
    }
  ]
}
