Pular para conteúdo

🌐 API Documentation Index

Author: Anderson Henrique da Silva Location: Minas Gerais, Brazil Created: 2025-11-08 Last Updated: 2025-11-18 Production URL: https://cidadao-api-production.up.railway.app


📑 Quick Navigation

Core API Documentation

Integration Guides


💬 Chat & Communication APIs

REST Chat

Real-time Communication

GraphQL

  • GRAPHQL_IMPLEMENTATION.md - GraphQL API (95% complete)
  • Schema with types (User, Investigation, Finding, Anomaly, Contract)
  • Queries, mutations, and subscriptions
  • Playground at /graphql/playground

📊 Status & Monitoring

Integration Status

Metrics & Monitoring

  • AGENT_METRICS_DASHBOARD.md - Prometheus & Grafana dashboards
  • Real-time metrics collection
  • Agent performance monitoring
  • API endpoint for metrics

🏗️ API Architecture Diagram

graph TB
    Client[🌐 Client Applications]

    subgraph "API Layer"
        REST[REST API<br/>266+ endpoints]
        WS[WebSocket API<br/>70% complete]
        GQL[GraphQL API<br/>95% complete]
        SSE[SSE Streaming<br/>Chat API]
    end

    subgraph "Core Services"
        Agents[🤖 Agent System<br/>16 agents]
        Investigation[🔍 Investigation Service]
        Orchestration[🎭 Orchestration]
        Auth[🔐 Authentication]
    end

    subgraph "Data Sources"
        subgraph "Government APIs"
            PNCP[PNCP<br/>Procurement]
            Portal[Portal Transparência<br/>22% working]
            IBGE[IBGE<br/>Demographics]
            DataSUS[DataSUS<br/>Healthcare]
            INEP[INEP<br/>Education]
            TCE[State TCEs<br/>6 states]
        end

        DB[(PostgreSQL<br/>Database)]
        Cache[(Redis<br/>Cache)]
    end

    Client --> REST
    Client --> WS
    Client --> GQL
    Client --> SSE

    REST --> Auth
    WS --> Auth
    GQL --> Auth
    SSE --> Auth

    Auth --> Agents
    Auth --> Investigation
    Auth --> Orchestration

    Agents --> DB
    Agents --> Cache

    Investigation --> Agents
    Investigation --> DB

    Orchestration --> PNCP
    Orchestration --> Portal
    Orchestration --> IBGE
    Orchestration --> DataSUS
    Orchestration --> INEP
    Orchestration --> TCE

    style Client fill:#e1f5ff,stroke:#333,stroke-width:2px
    style REST fill:#c3f0c3,stroke:#333,stroke-width:2px
    style WS fill:#fff4c3,stroke:#333,stroke-width:2px
    style GQL fill:#fff4c3,stroke:#333,stroke-width:2px
    style SSE fill:#c3f0c3,stroke:#333,stroke-width:2px
    style Agents fill:#e1f5ff,stroke:#333,stroke-width:2px
    style DB fill:#ffc3c3,stroke:#333,stroke-width:2px
    style Cache fill:#ffc3c3,stroke:#333,stroke-width:2px

🔌 API Categories

Investigation APIs

  • /api/v1/investigations/ - CRUD operations for investigations
  • /api/v1/chat/ - Conversational interface
  • /api/v1/agents/ - Direct agent invocation

Government Data APIs

  • /api/v1/federal/ - Federal APIs (IBGE, DataSUS, INEP, PNCP)
  • /api/v1/transparency/ - Portal da Transparência
  • /api/v1/tce/ - State TCE endpoints (6 states)

Supabase Integration


🚀 API Endpoints Overview

Category Count Status
Total Endpoints 266+ ✅ Operational
Investigation 15 ✅ Complete
Chat/Agents 20 ✅ Complete
Federal Data 35+ ✅ Integrated
Transparency 8 (22% working) ⚠️ Limited
WebSocket 5 🟡 70% Complete
GraphQL 12 🟡 95% Complete

📝 Integration Status

Working Integrations (30+ APIs)

  • ✅ IBGE - Demographics and geographic data
  • ✅ DataSUS - Healthcare data
  • ✅ INEP - Education data
  • ✅ PNCP - Public procurement (new platform)
  • ✅ 6 State TCE APIs - Court of Accounts
  • ⚠️ Portal da Transparência - 22% endpoints working (78% return 403)

Real-time Features

  • ✅ Server-Sent Events (SSE) - Chat streaming
  • 🟡 WebSocket - 70% implemented
  • 🟡 GraphQL Subscriptions - 95% implemented


📋 Quick Reference

Authentication

  • JWT tokens for user authentication
  • API keys for service-to-service
  • IP whitelist for production

Rate Limiting

  • Per-user limits configured
  • Per-IP limits for anonymous requests
  • Agent pool management for concurrent requests

Response Formats

  • JSON (default)
  • Server-Sent Events (SSE) for chat
  • GraphQL for flexible queries

Swagger UI: https://cidadao-api-production.up.railway.app/docs GraphQL Playground: https://cidadao-api-production.up.railway.app/graphql/playground