diff --git a/swagger.yaml b/swagger.yaml index 3a2a4d4..9488ef6 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1,626 +1,940 @@ openapi: 3.1.0 info: - title: Trusted AI Auth API + title: Trusted AI Analyst Data API version: '1.0.0' description: > - Authentication and session-management endpoints required to reach the protected analyst UI - (dashboard, transaction review, company search, and company transactions). + Data endpoints powering the analyst dashboard, portfolio-wide transaction review, + company search, and per-company transaction drill-down experiences. servers: - - url: https://trusted-ai.local + - url: http://trusted_ai.test/api description: Local development (composer run dev) - - url: https://api.trusted-ai.example.com + - url: https://api.trusted-ai.com description: Production tags: - - name: Auth - description: Credential, session, and verification endpoints. - - name: TwoFactor - description: Manage the analyst’s Time-based One Time Password (TOTP) second factor. + - name: Dashboard + description: KPIs and alert overviews for the landing dashboard. + - name: Transactions + description: Portfolio-wide transaction review tooling. + - name: Companies + description: Company discovery and drill-down data. components: securitySchemes: sessionCookie: type: apiKey in: cookie name: laravel_session - description: Issued after login/two-factor completion; required for all protected routes. - xsrfToken: - type: apiKey - in: header - name: X-XSRF-TOKEN - description: CSRF token minted via `/sanctum/csrf-cookie` (or HTML meta); required by state-changing requests. + description: Browser session issued after login; required for all endpoints documented here. schemas: - AuthUser: + PaginationMeta: type: object - required: [id, name, email, emailVerified] + required: + - page + - perPage + - total + - lastPage + properties: + page: + type: integer + minimum: 1 + example: 1 + perPage: + type: integer + minimum: 1 + example: 12 + total: + type: integer + minimum: 0 + example: 128 + lastPage: + type: integer + minimum: 1 + example: 11 + CountAmountSummary: + type: object + required: + - count + - amount + properties: + count: + type: integer + minimum: 0 + example: 42 + amount: + type: number + format: double + example: 2750000.5 + description: Monetary volume in EUR unless noted otherwise. + StatusOption: + type: object + required: + - value + - label + properties: + value: + type: string + example: true_positive + label: + type: string + example: Bestätigte Treffer + ChannelOption: + type: object + required: + - value + - label + properties: + value: + type: string + example: SEPA + label: + type: string + example: SEPA + RiskSegment: + type: object + required: + - label + - count + - volume + properties: + label: + type: string + example: Kritisch (≥80) + count: + type: integer + example: 17 + volume: + type: number + format: double + example: 8900000.0 + TopCompanyAlert: + type: object + required: + - companyId + - companyName + - ticker + - sector + - alerts + - alertVolume + - avgRiskScore + properties: + companyId: + type: integer + example: 24 + companyName: + type: string + example: Allianz SE + ticker: + type: string + example: ALV + sector: + type: string + example: Insurance + alerts: + type: integer + example: 6 + alertVolume: + type: number + format: double + example: 1450000.0 + avgRiskScore: + type: integer + minimum: 0 + maximum: 100 + example: 82 + DashboardOverview: + type: object + required: + - generatedAt + - activeAnalysts + - totalTransactions + - totalVolume + - alertsToday + - averageAlertsPerAnalyst + - precisionRate + - activeAlerts + - riskSegments + - topCompanies + - runbooksExecutedToday + properties: + generatedAt: + type: string + format: date-time + example: '2025-01-19T07:30:00Z' + activeAnalysts: + type: integer + example: 24 + totalTransactions: + type: integer + example: 312 + totalVolume: + type: number + format: double + example: 98765432.1 + alertsToday: + type: integer + example: 56 + averageAlertsPerAnalyst: + type: integer + example: 3 + precisionRate: + type: integer + minimum: 0 + maximum: 100 + example: 84 + activeAlerts: + type: object + required: + - count + - highRiskCount + properties: + count: + type: integer + example: 128 + highRiskCount: + type: integer + example: 19 + riskSegments: + type: array + items: + $ref: '#/components/schemas/RiskSegment' + topCompanies: + type: array + maxItems: 3 + items: + $ref: '#/components/schemas/TopCompanyAlert' + runbooksExecutedToday: + type: integer + example: 41 + TransactionStatus: + type: string + enum: + - true_positive + - false_positive + - cleared + CompanySummary: + type: object + required: + - id + - name + - legalName + - ticker + - sector + - country + - headquarters + - kycRiskLevel + - summary properties: id: type: integer - format: int64 - example: 143 + example: 12 name: type: string - example: Alex Analyst - email: + example: Allianz + legalName: type: string - format: email - example: analyst@example.com - emailVerified: + example: Allianz SE + ticker: + type: string + example: ALV + sector: + type: string + example: Insurance + country: + type: string + example: Germany + headquarters: + type: string + example: Munich + kycRiskLevel: + type: string + example: high + summary: + type: string + example: Multinational insurance provider with EMEA focus. + CompanyDetail: + allOf: + - $ref: '#/components/schemas/CompanySummary' + - type: object + properties: + createdAt: + type: string + format: date-time + nullable: true + updatedAt: + type: string + format: date-time + nullable: true + TransactionPreview: + type: object + required: + - id + - company + - counterparty + - counterpartyCountry + - status + - statusLabel + - requiresReview + - riskScore + - amount + - currency + - reference + - channel + - executedAt + properties: + id: + type: integer + example: 512 + company: + $ref: '#/components/schemas/CompanySummary' + counterparty: + type: string + example: Alpine Holdings Ltd. + counterpartyCountry: + type: string + example: Switzerland + status: + $ref: '#/components/schemas/TransactionStatus' + statusLabel: + type: string + example: Bestätigter Treffer + requiresReview: type: boolean - description: Indicates whether the analyst passes the `verified` middleware. example: true - emailVerifiedAt: + riskScore: + type: integer + minimum: 0 + maximum: 100 + example: 87 + amount: + type: number + format: double + example: 245000.75 + currency: + type: string + example: EUR + reference: + type: string + example: PAY-2024-10-1942 + channel: + type: string + example: SWIFT + executedAt: type: string format: date-time + example: '2025-01-18T09:14:00Z' + flaggedReason: + type: string nullable: true - example: '2024-03-18T08:31:12Z' - roles: - type: array - items: - type: string - example: [analyst] - createdAt: + example: Counterparty on sanctions watchlist + TransactionSignal: + type: object + required: + - type + - value + properties: + type: + type: string + example: Adverse Media + value: + type: string + example: Enforcement action reported in 2024-11 + weight: + type: number + format: double + nullable: true + example: 0.8 + AlertSummary: + type: object + required: + - id + - counterparty + - executedAt + - channel + - status + - statusLabel + properties: + id: + type: integer + example: 911 + counterparty: + type: string + example: Northbridge Trading Ltd. + executedAt: type: string format: date-time - updatedAt: + example: '2025-01-18T14:52:00Z' + channel: + type: string + example: SWIFT + status: + $ref: '#/components/schemas/TransactionStatus' + statusLabel: + type: string + example: Bestätigter Treffer + riskScore: + type: integer + minimum: 0 + maximum: 100 + example: 92 + TransactionHistoryItem: + type: object + required: + - id + - executedAt + - channel + - reference + - amount + - currency + - riskScore + properties: + id: + type: integer + example: 877 + executedAt: type: string format: date-time - LoginResponse: - type: object - required: [user, twoFactorRequired] - properties: - user: - $ref: '#/components/schemas/AuthUser' - twoFactorRequired: - type: boolean - description: True when the next step is `/two-factor-challenge`. - example: false - TwoFactorPending: - type: object - required: [twoFactorRequired] - properties: - twoFactorRequired: - type: boolean - const: true - challengeToken: + example: '2024-12-22T15:37:00Z' + channel: type: string - description: Echo of the `login.id` stored server-side; clients must keep the accompanying session cookie. - example: 9b6c11f7-527a-4dc9-9c2b-8923e7c7a418 - remember: - type: boolean - description: Remember-me preference preserved through the challenge. - example: true - TwoFactorSuccess: - type: object - required: [user] - properties: - user: - $ref: '#/components/schemas/AuthUser' - ValidationError: - type: object - required: [message, errors] - properties: - message: + example: SWIFT + reference: type: string - example: The given data was invalid. - errors: + example: PAY-2024-12-1187 + amount: + type: number + format: double + example: 99000.0 + currency: + type: string + example: EUR + riskScore: + type: integer + minimum: 0 + maximum: 100 + example: 74 + RecommendedAction: + type: object + required: + - title + - description + properties: + title: + type: string + example: Verdachtsmeldung vorbereiten + description: + type: string + example: Erstellen Sie den Meldeentwurf für die FIU und sichern Sie Belege. + TransactionDetail: + allOf: + - $ref: '#/components/schemas/TransactionPreview' + - type: object + required: + - flaggedBy + - flaggedReason + - signals + properties: + flaggedBy: + type: string + example: Screening Engine + flaggedReason: + type: string + example: Counterparty matched to EU sanctions list + signals: + type: array + items: + $ref: '#/components/schemas/TransactionSignal' + TransactionCaseFile: + allOf: + - $ref: '#/components/schemas/TransactionDetail' + - type: object + properties: + recommendedActions: + type: array + items: + $ref: '#/components/schemas/RecommendedAction' + counterpartyHistory: + type: array + items: + $ref: '#/components/schemas/TransactionHistoryItem' + TransactionMetrics: + type: object + required: + - total + - byStatus + properties: + total: + $ref: '#/components/schemas/CountAmountSummary' + byStatus: type: object additionalProperties: - type: array - items: - type: string - example: - email: - - These credentials do not match our records. - MessageResponse: + $ref: '#/components/schemas/CountAmountSummary' + description: Breakdown keyed by transaction status. + CompanyTransactionMetrics: type: object - required: [message] + required: + - totalCount + - totalVolume + - openAlerts + - highRiskShare + - last30Days + - byStatus properties: - message: - type: string - example: If an account exists, a reset link has been sent. - TooManyRequestsError: - type: object - required: [message, retryAfterSeconds] - properties: - message: - type: string - example: Too many login attempts. Try again in 48 seconds. - retryAfterSeconds: + totalCount: type: integer - example: 48 - RecoveryCodes: + example: 96 + totalVolume: + type: number + format: double + example: 7200000.0 + openAlerts: + $ref: '#/components/schemas/CountAmountSummary' + highRiskShare: + type: integer + minimum: 0 + maximum: 100 + example: 28 + last30Days: + $ref: '#/components/schemas/CountAmountSummary' + byStatus: + type: object + additionalProperties: + $ref: '#/components/schemas/CountAmountSummary' + TransactionCollectionResponse: type: object - required: [codes] + required: + - filters + - metrics + - data + - pagination properties: - codes: + filters: + type: object + properties: + statusOptions: + type: array + items: + $ref: '#/components/schemas/StatusOption' + perPage: + type: integer + example: 12 + metrics: + $ref: '#/components/schemas/TransactionMetrics' + data: type: array items: - type: string - example: [JQ7L-9PKM, ZG28-5TQF] - QrCodeSvg: + $ref: '#/components/schemas/TransactionPreview' + pagination: + $ref: '#/components/schemas/PaginationMeta' + selectedTransactionId: + type: integer + nullable: true + example: 512 + selectedTransaction: + allOf: + - $ref: '#/components/schemas/TransactionDetail' + nullable: true + CompanySearchOverview: type: object - required: [svg] + required: + - totalCompanies + - openAlerts + - openAlertVolume + - averageRiskScore + - watchlistHits + - automationShare properties: - svg: - type: string - format: byte - description: Base64-encoded SVG markup for authenticator enrollment. - SecretKey: + totalCompanies: + type: integer + example: 40 + openAlerts: + type: integer + example: 112 + openAlertVolume: + type: number + format: double + example: 5640000.0 + averageRiskScore: + type: integer + minimum: 0 + maximum: 100 + example: 71 + watchlistHits: + type: integer + example: 9 + automationShare: + type: integer + minimum: 0 + maximum: 100 + example: 82 + CompanyAlertPreview: type: object - required: [secret] + required: + - transactionId + - counterparty + - executedAt + - channel + - flaggedReason properties: - secret: + transactionId: + type: integer + example: 731 + counterparty: type: string - description: Plain-text TOTP secret for manual entry. - example: NB2W45DFOIZA==== + example: Baltic Commodities LLC + executedAt: + type: string + format: date-time + example: '2025-01-17T11:48:00Z' + channel: + type: string + example: SWIFT + flaggedReason: + type: string + example: Pattern matches sanctions typology + riskScore: + type: integer + minimum: 0 + maximum: 100 + example: 88 + CompanySearchResult: + allOf: + - $ref: '#/components/schemas/CompanySummary' + - type: object + required: + - alertCount + - alertVolume + - alertRiskScore + - latestAlert + properties: + alertCount: + type: integer + example: 7 + alertVolume: + type: number + format: double + example: 980000.0 + alertRiskScore: + type: integer + minimum: 0 + maximum: 100 + example: 79 + latestAlert: + allOf: + - $ref: '#/components/schemas/CompanyAlertPreview' + CompanySearchResponse: + type: object + required: + - overview + - results + - meta + properties: + overview: + $ref: '#/components/schemas/CompanySearchOverview' + results: + type: array + items: + $ref: '#/components/schemas/CompanySearchResult' + meta: + type: object + required: + - query + - resultCount + - limit + properties: + query: + type: string + nullable: true + example: Allianz + resultCount: + type: integer + example: 6 + limit: + type: integer + example: 6 + CompanyTransactionsResponse: + type: object + required: + - company + - filters + - metrics + - data + - pagination + properties: + company: + $ref: '#/components/schemas/CompanyDetail' + filters: + type: object + properties: + statusOptions: + type: array + items: + $ref: '#/components/schemas/StatusOption' + channelOptions: + type: array + items: + $ref: '#/components/schemas/ChannelOption' + metrics: + $ref: '#/components/schemas/CompanyTransactionMetrics' + data: + type: array + items: + $ref: '#/components/schemas/TransactionPreview' + pagination: + $ref: '#/components/schemas/PaginationMeta' + selectedTransactionId: + type: integer + nullable: true + example: 877 + selectedTransaction: + allOf: + - $ref: '#/components/schemas/TransactionCaseFile' + nullable: true + recentAlerts: + type: array + items: + $ref: '#/components/schemas/AlertSummary' paths: - /auth/session: + /dashboard/overview: get: - tags: [Auth] - summary: Fetch the authenticated analyst + tags: + - Dashboard + operationId: getDashboardOverview + summary: Retrieve dashboard overview metrics description: > - Confirms session status and email verification before loading guarded UI routes. + Aggregated KPIs and alert slices needed for the dashboard hero cards and side panels. security: - sessionCookie: [] responses: '200': - description: Active, verified session. + description: Overview data ready for dashboard rendering. content: application/json: schema: - $ref: '#/components/schemas/AuthUser' + $ref: '#/components/schemas/DashboardOverview' '401': - description: Missing or expired session cookie. - '403': - description: Analyst authenticated but email remains unverified. - /login: - post: - tags: [Auth] - summary: Authenticate an analyst - description: > - Validates credentials and issues a new session cookie, matching the login Volt component. - security: - - xsrfToken: [] - requestBody: - required: true - content: - application/json: - schema: - type: object - required: [email, password] - properties: - email: - type: string - format: email - example: analyst@example.com - password: - type: string - format: password - example: correct-horse-battery-staple - remember: - type: boolean - default: false - responses: - '200': - description: Login successful; analyst may navigate to protected pages. - headers: - Set-Cookie: - description: Refreshed `laravel_session` cookie. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/LoginResponse' - '202': - description: Second factor required before granting access. - headers: - Set-Cookie: - description: Session cookie plus `login.id`/`login.remember` context. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/TwoFactorPending' - '422': - description: Validation failed (bad credentials, throttled). - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - '429': - description: Too many attempts; obey lockout timings. - content: - application/json: - schema: - $ref: '#/components/schemas/TooManyRequestsError' - /two-factor-challenge: - post: - tags: [Auth] - summary: Confirm the TOTP or recovery code - description: > - Completes the pending session when two-factor authentication is enabled. - security: - - xsrfToken: [] - - sessionCookie: [] - requestBody: - required: true - content: - application/json: - schema: - type: object - oneOf: - - required: [code] - properties: - code: - type: string - pattern: '^\d{6}$' - description: 6-digit TOTP value. - - required: [recovery_code] - properties: - recovery_code: - type: string - description: Emergency recovery code. - responses: - '200': - description: Two-factor validated; session promoted to fully authenticated. - headers: - Set-Cookie: - description: Session cookie extended per remember-me preference. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/TwoFactorSuccess' - '422': - description: Invalid TOTP or recovery code. - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - '429': - description: Too many challenge attempts (Fortify `two-factor` limiter). - content: - application/json: - schema: - $ref: '#/components/schemas/TooManyRequestsError' - /logout: - post: - tags: [Auth] - summary: Terminate the active session - description: > - Logs the analyst out and invalidates the session cookie. - security: - - xsrfToken: [] - - sessionCookie: [] - responses: - '204': - description: Logout succeeded; client should discard session cookies. - '401': - description: Analyst was not logged in. - /register: - post: - tags: [Auth] - summary: Register a new analyst - description: > - Creates an account and authenticates immediately, matching the register Volt component. - security: - - xsrfToken: [] - requestBody: - required: true - content: - application/json: - schema: - type: object - required: [name, email, password, password_confirmation] - properties: - name: - type: string - example: Jamie Investigator - email: - type: string - format: email - password: - type: string - format: password - password_confirmation: - type: string - format: password - responses: - '201': - description: Account created; dashboard can load. - headers: - Set-Cookie: - description: Session cookie for the new account. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/LoginResponse' - '422': - description: Validation errors (duplicate email, weak password, mismatch). - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - /forgot-password: - post: - tags: [Auth] - summary: Send password reset link - description: > - Sends the reset email while obscuring account existence. - security: - - xsrfToken: [] - requestBody: - required: true - content: - application/json: - schema: - type: object - required: [email] - properties: - email: - type: string - format: email - responses: - '202': - description: Reset notification dispatched if the account exists. - content: - application/json: - schema: - $ref: '#/components/schemas/MessageResponse' - '422': - description: Email field invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - /reset-password: - post: - tags: [Auth] - summary: Reset password with token - description: > - Applies a valid reset token and forces the analyst to log in again. - security: - - xsrfToken: [] - requestBody: - required: true - content: - application/json: - schema: - type: object - required: [token, email, password, password_confirmation] - properties: - token: - type: string - description: Token from the password reset email. - email: - type: string - format: email - password: - type: string - format: password - password_confirmation: - type: string - format: password - responses: - '204': - description: Password updated; analyst should be redirected to `/login`. - '422': - description: Invalid token or password validation failure. - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - /user/confirm-password: - post: - tags: [Auth] - summary: Confirm password for sensitive operations - description: > - Required before enabling/disabling 2FA when the `password.confirm` middleware is active. - security: - - xsrfToken: [] - - sessionCookie: [] - requestBody: - required: true - content: - application/json: - schema: - type: object - required: [password] - properties: - password: - type: string - format: password - responses: - '204': - description: Password confirmed for the next 900 seconds. - '422': - description: Wrong password submitted. - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - /email/verification-notification: - post: - tags: [Auth] - summary: Resend email verification link - description: > - Needed because dashboard and investigation routes require the `verified` middleware. - security: - - xsrfToken: [] - - sessionCookie: [] - responses: - '202': - description: Verification email dispatched (throttled at 6/hour). - content: - application/json: - schema: - $ref: '#/components/schemas/MessageResponse' - '429': - description: Throttle limit exceeded. - content: - application/json: - schema: - $ref: '#/components/schemas/TooManyRequestsError' - /email/verify/{id}/{hash}: + description: Session invalid or expired. + /transactions: get: - tags: [Auth] - summary: Mark email address as verified + tags: + - Transactions + operationId: listTransactions + summary: List transactions with global filters description: > - Consumes the signed verification link and redirects to the front end. + Returns the paginated transaction stream together with per-status metrics and default selection, + mirroring the Livewire transaction review experience. + security: + - sessionCookie: [] parameters: - - name: id - in: path - required: true - schema: - type: integer - - name: hash - in: path - required: true + - name: search + in: query schema: type: string - - name: signature + description: Match against reference, counterparty, or company identifiers. + - name: status in: query - required: true schema: type: string - - name: expires + enum: + - all + - true_positive + - false_positive + - cleared + default: all + description: Filter by review status; `all` keeps every status. + - name: page in: query - required: true schema: type: integer - responses: - '302': - description: Redirect to `/dashboard?verified=1` (default). - headers: - Location: - schema: - type: string - '403': - description: Link expired or signature mismatch. - /user/two-factor-authentication: - post: - tags: [TwoFactor] - summary: Start enrolling two-factor authentication - description: > - Generates the TOTP secret and makes QR/manual data available. - security: - - xsrfToken: [] - - sessionCookie: [] + minimum: 1 + default: 1 + - name: perPage + in: query + schema: + type: integer + minimum: 1 + maximum: 100 + default: 12 responses: '200': - description: Enrollment started; fetch QR/secret next. + description: Paginated transaction set with metrics. content: application/json: schema: - $ref: '#/components/schemas/MessageResponse' - example: - message: Two-factor authentication seed generated. - '423': - description: Password confirmation required. - '429': - description: Too many enable attempts. - delete: - tags: [TwoFactor] - summary: Disable two-factor authentication - security: - - xsrfToken: [] - - sessionCookie: [] - responses: - '204': - description: Two-factor disabled and secrets cleared. - '423': - description: Password confirmation required. - /user/confirmed-two-factor-authentication: - post: - tags: [TwoFactor] - summary: Confirm two-factor setup - description: > - Completes enrollment by verifying a TOTP code. - security: - - xsrfToken: [] - - sessionCookie: [] - requestBody: - required: true - content: - application/json: - schema: - type: object - required: [code] - properties: - code: - type: string - pattern: '^\d{6}$' - description: 6-digit TOTP code. - responses: - '204': - description: Two-factor authentication confirmed. - '422': - description: Invalid confirmation code. - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - /user/two-factor-qr-code: + $ref: '#/components/schemas/TransactionCollectionResponse' + '401': + description: Session invalid or expired. + /transactions/{transactionId}: get: - tags: [TwoFactor] - summary: Retrieve QR code SVG + tags: + - Transactions + operationId: getTransactionCaseFile + summary: Fetch a single transaction case file description: > - Supplies the SVG rendered in the settings modal during enrollment. + Detailed transaction record used when an analyst expands a case in the transaction review workspace. security: - sessionCookie: [] + parameters: + - name: transactionId + in: path + required: true + schema: + type: integer responses: '200': - description: SVG payload for authenticator scanning. + description: Transaction detail with detection signals. content: application/json: schema: - $ref: '#/components/schemas/QrCodeSvg' + $ref: '#/components/schemas/TransactionDetail' + '401': + description: Session invalid or expired. '404': - description: Two-factor enrollment not in progress. - /user/two-factor-secret-key: + description: Transaction not found. + /companies/search: get: - tags: [TwoFactor] - summary: Retrieve manual setup key + tags: + - Companies + operationId: searchCompanies + summary: Search companies and retrieve screening overview description: > - Provides the fallback alphanumeric key shown alongside the QR code. + Provides the metrics and top results required to populate the company search tiles. security: - sessionCookie: [] + parameters: + - name: q + in: query + schema: + type: string + description: Free-text query across name, legal name, ticker, or sector. + - name: limit + in: query + schema: + type: integer + minimum: 1 + maximum: 25 + default: 6 responses: '200': - description: Secret key for manual entry. + description: Matching companies with alert context. content: application/json: schema: - $ref: '#/components/schemas/SecretKey' - /user/two-factor-recovery-codes: + $ref: '#/components/schemas/CompanySearchResponse' + '401': + description: Session invalid or expired. + /companies/{companyId}: get: - tags: [TwoFactor] - summary: List recovery codes + tags: + - Companies + operationId: getCompany + summary: Retrieve a company profile + description: > + Returns core firmographics and KYC risk tier needed for per-company transaction pages. security: - sessionCookie: [] + parameters: + - name: companyId + in: path + required: true + schema: + type: integer responses: '200': - description: Recovery codes ready for display or download. + description: Company detail. content: application/json: schema: - $ref: '#/components/schemas/RecoveryCodes' - post: - tags: [TwoFactor] - summary: Regenerate recovery codes + $ref: '#/components/schemas/CompanyDetail' + '401': + description: Session invalid or expired. + '404': + description: Company not found. + /companies/{companyId}/transactions: + get: + tags: + - Companies + operationId: listCompanyTransactions + summary: List transactions for a specific company + description: > + Supplies per-company metrics, channel/status filters, paginated cases, and the current selection + for the company drill-down view. security: - - xsrfToken: [] - sessionCookie: [] + parameters: + - name: companyId + in: path + required: true + schema: + type: integer + - name: status + in: query + schema: + type: string + enum: + - all + - true_positive + - false_positive + - cleared + default: all + - name: channel + in: query + schema: + type: string + default: all + description: Channel label returned in channelOptions; use `all` for no filtering. + - name: page + in: query + schema: + type: integer + minimum: 1 + default: 1 + - name: perPage + in: query + schema: + type: integer + minimum: 1 + maximum: 100 + default: 10 responses: - '201': - description: New recovery codes generated and returned. + '200': + description: Company-specific transaction data with metrics. content: application/json: schema: - $ref: '#/components/schemas/RecoveryCodes' - '423': - description: Password confirmation required. + $ref: '#/components/schemas/CompanyTransactionsResponse' + '401': + description: Session invalid or expired. + '404': + description: Company not found or no transactions. + /companies/{companyId}/transactions/{transactionId}: + get: + tags: + - Companies + operationId: getCompanyTransactionCaseFile + summary: Fetch a company transaction case file with history + description: > + Returns the selected transaction enriched with recommended actions and counterparty history + used in the right-hand panel of the company drill-down. + security: + - sessionCookie: [] + parameters: + - name: companyId + in: path + required: true + schema: + type: integer + - name: transactionId + in: path + required: true + schema: + type: integer + responses: + '200': + description: Transaction case file for the company context. + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionCaseFile' + '401': + description: Session invalid or expired. + '404': + description: Transaction not found for the given company.