{
  "info": {
    "name": "MasteryHive Partner APIs",
    "description": "Partner collection template. Set environment variables \u2014 never commit secrets. Base URLs for cloud are OWNER DECISION REQUIRED.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "fraud_ml_base",
      "value": "http://localhost:8080"
    },
    {
      "key": "fraud_rule_base",
      "value": "http://localhost:8081"
    },
    {
      "key": "fraud_case_base",
      "value": "http://localhost:8082"
    },
    {
      "key": "kyc_base",
      "value": "http://localhost:8000"
    },
    {
      "key": "recon_base",
      "value": "http://localhost:8001/v1"
    },
    {
      "key": "tenant_id",
      "value": "YOUR_TENANT_ID"
    },
    {
      "key": "partner_id",
      "value": "YOUR_PARTNER_ID"
    },
    {
      "key": "fraud_jwt",
      "value": "PASTE_RS256_JWT_HERE"
    },
    {
      "key": "user_id",
      "value": "00000000-0000-0000-0000-000000000001"
    },
    {
      "key": "session_id",
      "value": "00000000-0000-0000-0000-000000000099"
    }
  ],
  "item": [
    {
      "name": "Fraud",
      "item": [
        {
          "name": "ML call-and-predict",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "ApiKey {{fraud_jwt}}"
              },
              {
                "key": "x-tenant-id",
                "value": "{{tenant_id}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{fraud_ml_base}}/call-and-predict",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"timestamp\": \"2024-12-31 21:55:44\",\n  \"type\": \"transaction\",\n  \"event\": {\n    \"transaction\": {\n      \"id\": \"5753ed0f-7c8e-4bdc-8056-d8dd50fc1db0\",\n      \"time\": \"21:55:44\",\n      \"date\": \"2024-12-31\",\n      \"amount\": 26130.92,\n      \"currency\": \"NGN\",\n      \"description\": \"Boutique purchase\",\n      \"type\": \"bill payment\",\n      \"channel\": \"WEB\"\n    },\n    \"user\": {\"user_id\": \"{{user_id}}\"},\n    \"merchant\": {\"id\": \"m-1\", \"name\": \"Example\"},\n    \"location\": {\"country\": \"NG\"},\n    \"account\": {}\n  }\n}"
            }
          }
        },
        {
          "name": "Rule rule_based_engine",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "ApiKey {{fraud_jwt}}"
              },
              {
                "key": "x-tenant-id",
                "value": "{{tenant_id}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{fraud_rule_base}}/rule_based_engine",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event\": {\n    \"transaction\": {\"id\": \"5753ed0f-7c8e-4bdc-8056-d8dd50fc1db0\", \"time\": \"21:55:44\", \"date\": \"2024-12-31\", \"amount\": 500000, \"currency\": \"NGN\", \"channel\": \"APP\"},\n    \"user\": {\"user_id\": \"{{user_id}}\"},\n    \"merchant\": {\"id\": null},\n    \"location\": {},\n    \"account\": {}\n  },\n  \"rules\": [{\n    \"id\": \"rule-amount\",\n    \"score\": 80,\n    \"conditionGroup\": {\"id\": \"g1\", \"operator\": \"AND\", \"conditions\": [{\"field\": \"transaction.amount\", \"operator\": \"GT\", \"value\": 100000}], \"subGroups\": []}\n  }]\n}"
            }
          }
        }
      ]
    },
    {
      "name": "KYC",
      "item": [
        {
          "name": "Health",
          "request": {
            "method": "GET",
            "url": "{{kyc_base}}/health"
          }
        },
        {
          "name": "Prembly ID check",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{kyc_base}}/prembly_id_check",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"{{user_id}}\",\n  \"idType\": \"NIN\",\n  \"idNumber\": \"REPLACE_WITH_TEST_ID\"\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Reconciliation",
      "item": [
        {
          "name": "Start money ingestion",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{recon_base}}/ingestion/background",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"session_id\": \"{{session_id}}\",\n  \"tenant_id\": \"{{tenant_id}}\",\n  \"partner_id\": \"{{partner_id}}\",\n  \"gl_file_url\": [\"https://storage.googleapis.com/EXAMPLE_BUCKET/gl.csv\"],\n  \"bank_file_url\": [\"https://storage.googleapis.com/EXAMPLE_BUCKET/bank.csv\"],\n  \"on_existing_action\": \"overwrite\"\n}"
            }
          }
        },
        {
          "name": "Pipeline status",
          "request": {
            "method": "GET",
            "url": "{{recon_base}}/loader/pipeline-status/{{session_id}}"
          }
        },
        {
          "name": "Resolve exception",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{recon_base}}/exceptions/resolve",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"resolution_request_id\": \"res-001\",\n  \"partner_id\": \"{{partner_id}}\",\n  \"tenant_id\": \"{{tenant_id}}\",\n  \"decision\": \"approved\",\n  \"customer_type\": \"banking\",\n  \"cluster_type\": \"amount_mismatch\",\n  \"note\": \"operator note\"\n}"
            }
          }
        }
      ]
    }
  ]
}
