openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 1.0.0 description: Glass-Box Card Servicing Agent API servers: - url: "" description: Base path (backend URL set via setBaseUrl in app) tags: - name: health description: Health operations - name: chat description: Conversational agent chat - name: escalations description: Human escalation queue - name: ledger description: Tamper-evident audit ledger paths: /health: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /chat: post: operationId: sendChat tags: [chat] summary: Send a message through the agent pipeline requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ChatInput" responses: "200": description: Pipeline response content: application/json: schema: $ref: "#/components/schemas/ChatResponse" "500": description: Pipeline error /escalations: get: operationId: listEscalations tags: [escalations] summary: List escalations, optionally filtered by status parameters: - name: status in: query required: false schema: type: string enum: [pending, approved, rejected, modified] responses: "200": description: List of escalations content: application/json: schema: $ref: "#/components/schemas/EscalationList" /escalations/{escalation_id}/resolve: post: operationId: resolveEscalation tags: [escalations] summary: Approve, reject, or modify a pending escalation parameters: - name: escalation_id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EscalationResolveInput" responses: "200": description: Escalation resolved content: application/json: schema: $ref: "#/components/schemas/EscalationResolveResult" "404": description: Escalation not found /ledger/{session_id}: get: operationId: getSessionLedger tags: [ledger] summary: Get all ledger entries for a session parameters: - name: session_id in: path required: true schema: type: string responses: "200": description: Session ledger entries content: application/json: schema: $ref: "#/components/schemas/LedgerResponse" /ledger/customer/{customer_id}: get: operationId: getCustomerLedger tags: [ledger] summary: Get all ledger entries for a customer across all sessions parameters: - name: customer_id in: path required: true schema: type: string responses: "200": description: Customer ledger entries content: application/json: schema: $ref: "#/components/schemas/CustomerLedgerResponse" /ledger/verify/{customer_id}: get: operationId: verifyLedger tags: [ledger] summary: Verify hash-chain integrity for all of a customer's ledger entries parameters: - name: customer_id in: path required: true schema: type: string responses: "200": description: Verification result content: application/json: schema: $ref: "#/components/schemas/LedgerVerifyResult" components: schemas: HealthStatus: type: object properties: status: type: string service: type: string required: - status # ── Chat ────────────────────────────────────────────────────────────────── ChatInput: type: object required: [customer_id, message] properties: session_id: type: ["string", "null"] customer_id: type: string message: type: string ChatResponse: type: object required: [session_id, reply] properties: session_id: type: string reply: type: string classification: oneOf: - $ref: "#/components/schemas/Classification" - type: "null" resolver_proposal: oneOf: - $ref: "#/components/schemas/ResolverProposal" - type: "null" policy_verdict: oneOf: - $ref: "#/components/schemas/PolicyVerdict" - type: "null" auditor_verdict: oneOf: - $ref: "#/components/schemas/AuditorVerdict" - type: "null" ladder_decision: type: ["string", "null"] action_result: type: ["object", "null"] additionalProperties: true Classification: type: object required: [intent, confidence, sentiment_score, frustrated] properties: intent: type: string enum: [fee_waiver, credit_limit_increase, card_replacement, unclear] confidence: type: number minimum: 0 maximum: 1 extracted_entities: type: object additionalProperties: true sentiment_score: type: integer minimum: 1 maximum: 5 description: "1=positive/happy, 5=extremely frustrated/angry" frustrated: type: boolean ResolverProposal: type: object required: [action, confidence, customer_facing_draft_reply] properties: action: type: string enum: [waive_fee, adjust_limit, reissue_card, no_action_needed, need_more_info] amount: type: ["number", "null"] reason_code: type: ["string", "null"] confidence: type: number minimum: 0 maximum: 1 missing_info_question: type: ["string", "null"] customer_facing_draft_reply: type: string PolicyVerdict: type: object required: [verdict, rule_id] properties: verdict: type: string enum: [ALLOW, ALLOW_WITH_CAP, DENY] capped_amount: type: ["number", "null"] rule_id: type: string AuditorVerdict: type: object required: [verdict] properties: verdict: type: string enum: [APPROVE, KICK_BACK, ESCALATE] reason: type: ["string", "null"] risk_flags: type: array items: type: string # ── Escalations ─────────────────────────────────────────────────────────── Escalation: type: object required: [id, session_id, customer_id, proposal, policy_verdict, auditor_verdict, ladder_decision, status, created_at] properties: id: type: integer session_id: type: string customer_id: type: string proposal: $ref: "#/components/schemas/ResolverProposal" policy_verdict: $ref: "#/components/schemas/PolicyVerdict" auditor_verdict: $ref: "#/components/schemas/AuditorVerdict" ladder_decision: type: string status: type: string enum: [pending, approved, rejected, modified] created_at: type: string resolved_at: type: ["string", "null"] EscalationList: type: object required: [escalations, total] properties: escalations: type: array items: $ref: "#/components/schemas/Escalation" total: type: integer EscalationResolveInput: type: object required: [action] properties: action: type: string enum: [approve, reject, modify] modified_amount: type: ["number", "null"] modified_reason_code: type: ["string", "null"] EscalationResolveResult: type: object required: [status] properties: status: type: string message: type: ["string", "null"] action_result: type: ["object", "null"] additionalProperties: true # ── Ledger ──────────────────────────────────────────────────────────────── LedgerEntry: type: object required: [customer_id, session_id, step_type, payload, prev_hash, entry_hash, entry_time] properties: id: type: ["integer", "null"] customer_id: type: string session_id: type: string step_type: type: string payload: type: string prev_hash: type: string entry_hash: type: string entry_time: type: string signature: type: ["string", "null"] LedgerResponse: type: object required: [session_id, entries, total] properties: session_id: type: string entries: type: array items: $ref: "#/components/schemas/LedgerEntry" total: type: integer CustomerLedgerResponse: type: object required: [customer_id, entries, total] properties: customer_id: type: string entries: type: array items: $ref: "#/components/schemas/LedgerEntry" total: type: integer LedgerVerifyResult: type: object required: [valid, customer_id, total_entries] properties: valid: type: boolean customer_id: type: string total_entries: type: integer tampered_entry: type: ["object", "null"] additionalProperties: true error: type: ["string", "null"]