{
  "openapi": "3.1.0",
  "info": {
    "title": "Remitly Hub Analytics API & Data Specification",
    "description": "Developer specifications, data models, and analytical schemas for Remitly Hub by k007sam. Provides complete schemas for Remitly CSV parsing, beneficiary aggregation, and multi-year financial statements.",
    "version": "1.0.0",
    "contact": {
      "name": "k007sam Developer Support",
      "url": "https://github.com/k007sam",
      "email": "support@k007sam.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://remitly.k007sam.com",
      "description": "Production Web & Client-Side Analytics Host"
    }
  ],
  "paths": {
    "/docs": {
      "get": {
        "summary": "Developer Documentation & Algorithm Specifications",
        "description": "Retrieves developer documentation detailing the CSV parsing algorithms, grouping logic, and security model.",
        "responses": {
          "200": {
            "description": "HTML or Markdown documentation depending on Accept header",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "summary": "AI Agent Discovery & Usage Instructions",
        "description": "Returns standard llms.txt discovery file outlining when to use Remitly Hub.",
        "responses": {
          "200": {
            "description": "Plain text agent instructions",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Transaction": {
        "type": "object",
        "required": [
          "id",
          "date",
          "recipientName",
          "status",
          "sendAmount",
          "sendCurrency",
          "receiveAmount",
          "receiveCurrency",
          "fee",
          "exchangeRate"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique transaction reference ID"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Execution timestamp of transaction"
          },
          "year": {
            "type": "integer",
            "description": "Parsed calendar year (2018-2026)"
          },
          "recipientName": {
            "type": "string",
            "description": "Full beneficiary recipient name"
          },
          "status": {
            "type": "string",
            "enum": ["Delivered", "Cancelled", "In Progress", "Refunded"],
            "description": "Transfer delivery status"
          },
          "sendAmount": {
            "type": "number",
            "description": "Principal amount sent"
          },
          "sendCurrency": {
            "type": "string",
            "description": "Funding currency ISO code (e.g., USD)"
          },
          "receiveAmount": {
            "type": "number",
            "description": "Payout amount in destination currency"
          },
          "receiveCurrency": {
            "type": "string",
            "description": "Destination currency ISO code (e.g., PHP, INR)"
          },
          "fee": {
            "type": "number",
            "description": "Remitly service fee"
          },
          "exchangeRate": {
            "type": "number",
            "description": "Applied foreign exchange rate"
          }
        }
      },
      "BeneficiarySummary": {
        "type": "object",
        "required": [
          "beneficiaryName",
          "totalSent",
          "transferCount",
          "transactions"
        ],
        "properties": {
          "beneficiaryName": {
            "type": "string",
            "description": "Consolidated canonical beneficiary name"
          },
          "totalSent": {
            "type": "number",
            "description": "Cumulative amount sent to this recipient"
          },
          "transferCount": {
            "type": "integer",
            "description": "Number of transactions sent to this recipient"
          },
          "averageTransfer": {
            "type": "number",
            "description": "Mean transfer size"
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transaction"
            }
          }
        }
      },
      "FinancialAnalyticsReport": {
        "type": "object",
        "properties": {
          "totalVolumeSent": {
            "type": "number",
            "description": "Grand total of outbound transfers"
          },
          "totalFeesPaid": {
            "type": "number",
            "description": "Grand total of service fees"
          },
          "totalTransactions": {
            "type": "integer",
            "description": "Total executed transfers"
          },
          "uniqueBeneficiaries": {
            "type": "integer",
            "description": "Count of distinct recipients"
          },
          "yearlyBreakdown": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          }
        }
      }
    }
  }
}
