{
  "openapi": "3.0.3",
  "info": {
    "title": "Fieldproof Partner API",
    "description": "Field collections as an API for regulated lenders. Push overdue cases, read case status, poll updates, confirm payments and manage webhook deliveries.\n\nAuth is a Bearer apiKeyId plus an HMAC-SHA256 signature over the canonical request (see Authentication → Signing requests). Keys are environment-locked: a test key is rejected on production and vice versa.\n\nMoney never routes through Fieldproof — collections land directly on your own payment rails, and cash is never accepted.",
    "version": "1.0.0",
    "contact": {
      "name": "Fieldproof Integration Support",
      "url": "https://developers.fluxusforge.in",
      "email": "partners@fluxusforge.in"
    },
    "license": {
      "name": "Proprietary — Fluxus Forge Private Limited"
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Partner-app JWT OR CRM-user JWT (depending on the endpoint)"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "MANAGER_API_KEY for service-to-service admin calls"
      }
    },
    "schemas": {}
  },
  "paths": {
    "/api/v1/partner/health": {
      "get": {
        "summary": "GET /api/v1/partner/health",
        "tags": [
          "External Org API"
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/cases": {
      "post": {
        "summary": "POST /api/v1/partner/cases",
        "tags": [
          "External Org API"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "rows"
                ],
                "properties": {
                  "fullSnapshot": {
                    "type": "boolean"
                  },
                  "rows": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/cases/updates": {
      "get": {
        "summary": "GET /api/v1/partner/cases/updates",
        "tags": [
          "External Org API"
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/cases/{sourceLoanNumber}": {
      "get": {
        "summary": "GET /api/v1/partner/cases/:sourceLoanNumber",
        "tags": [
          "External Org API"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sourceLoanNumber",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/cases/{sourceLoanNumber}/recall": {
      "post": {
        "summary": "POST /api/v1/partner/cases/:sourceLoanNumber/recall",
        "tags": [
          "External Org API"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sourceLoanNumber",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/webhooks/test": {
      "post": {
        "summary": "POST /api/v1/partner/webhooks/test",
        "tags": [
          "External Org API"
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/webhooks/deliveries": {
      "get": {
        "summary": "GET /api/v1/partner/webhooks/deliveries",
        "tags": [
          "External Org API"
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/webhooks/deliveries/{eventId}/replay": {
      "post": {
        "summary": "POST /api/v1/partner/webhooks/deliveries/:eventId/replay",
        "tags": [
          "External Org API"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "eventId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/debug/echo-signature": {
      "post": {
        "summary": "POST /api/v1/partner/debug/echo-signature",
        "tags": [
          "External Org API"
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/openapi.json": {
      "get": {
        "summary": "GET /api/v1/partner/openapi.json",
        "tags": [
          "External Org API"
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/partner/cases/{sourceLoanNumber}/payments/confirm": {
      "post": {
        "summary": "POST /api/v1/partner/cases/:sourceLoanNumber/payments/confirm",
        "tags": [
          "External Org API"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "amount",
                  "reference"
                ],
                "properties": {
                  "amount": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000000
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "paidAt": {
                    "type": "string"
                  },
                  "mode": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "linkId": {
                    "type": "string",
                    "maxLength": 128
                  }
                }
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sourceLoanNumber",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success — standard { success, data } envelope used across the API.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Success — standard { success, data } envelope used across the API.",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {}
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "External Org API",
      "description": "Self-serve API for lender organisations. Per-tenant HMAC auth; every read and write is scoped to your organisation at the query layer."
    }
  ],
  "servers": [
    {
      "url": "https://alpha-gig.quikkred.in",
      "description": "Sandbox — test keys only"
    },
    {
      "url": "https://gig.quikkred.in",
      "description": "Production — live keys, not browser-callable (no CORS)"
    }
  ]
}
