OpenAPI specification
MFI Suite publishes versioned OpenAPI specs so integration partners can auto-generate clients, validate requests, and import endpoints into Postman or Insomnia.

At a glance — OpenAPI version: 3.1.0. Locations: /api/openapi.json (v1), /api/v2/openapi.json (v2). Interactive docs: /api/docs (Swagger UI), /api/redoc (ReDoc). Generators: openapi-generator, openapi-typescript, swagger-codegen all tested.
Fetching the spec
# Public access (no auth required for spec)
curl https://microfinance.mybridgeerp.com/api/openapi.json > openapi.json
# Or open interactive UI in browser
open https://microfinance.mybridgeerp.com/api/docs
Spec structure
- info — title, version, contact, license
- servers — base URLs (production, staging)
- tags — endpoint grouping (Members, Loans, Savings, etc.)
- paths — all endpoints with parameters, request/response schemas
- components.schemas — reusable data types (Member, Loan, etc.)
- components.securitySchemes — OAuth2, ApiKey
- components.responses — standard 4xx/5xx error envelopes
Generating clients
Use the official openapi-generator for unsupported languages, or one of our SDKs (Python, Node, Java, Go).
# Generate a TypeScript axios client
npx openapi-typescript-codegen --input openapi.json \
--output ./mfi-client \
--client axios
# Generate a Java client
openapi-generator-cli generate -i openapi.json \
-g java -o ./mfi-java-client \
--additional-properties=library=resttemplate,artifactId=mfi-client
# Generate a Python client
openapi-generator-cli generate -i openapi.json \
-g python -o ./mfi-py-client
Schema validation
Use the spec to validate requests and responses in CI tests, preventing breakage when MFI Suite is upgraded.
from openapi_core import Spec, V31RequestValidator, V31ResponseValidator
import requests, json
spec = Spec.from_file('openapi.json')
# Validate request
req = ... # construct request object
V31RequestValidator(spec).validate(req)
# Validate response
resp = requests.get('https://microfinance.mybridgeerp.com/api/v1/loans/9183', ...)
V31ResponseValidator(spec).validate(req, resp)
Importing to Postman / Insomnia
- Open Postman, File > Import
- Choose Link, paste https://microfinance.mybridgeerp.com/api/openapi.json
- Import as Collection
- Set environment variable {{token}} via the OAuth helper
- Run any endpoint; the schema panel auto-validates request body
Worked scenarios
Scenario — Africa's Talking CI validates against MFI OpenAPI
| Character | Role |
|---|---|
| Samuel Kibet | Mwananchi DevOps |
| Aisha Hassan | Africa's Talking Integration Engineer |
Timeline
- Day 1, 10:00: Aisha adds openapi.json fetch to CI. (GitHub Action pulls spec nightly.)
- Day 2, 09:00: Spec changes — new field added_via_api_key on loan responses. (Spec sha differs.)
- Day 2, 09:01: CI runs schema diff. (Diff posted to PR comment for review.)
- Day 2, 14:00: Aisha updates mock responses to match new field. (Mock tests pass.)
- Day 2, 15:00: PR merged. (Production-pinned client still compatible due to additive change.)
Outcome — Spec-driven CI catches breakage before production. Africa's Talking client always tracks live spec.
Reference
Top-level schemas
| Schema | Description |
|---|---|
| Member | Full member profile including KYC |
| MemberSummary | Lite version for list endpoints |
| Loan | Full loan with schedule embedded |
| LoanSummary | Lite version |
| LoanScheduleLine | One row of repayment schedule |
| Disbursement | Disbursement event |
| Repayment | Repayment event |
| SavingsAccount | Savings account |
| SavingsTransaction | Savings book entry |
| MobileMoneyTransaction | M-Pesa/Airtel transaction |
| AMLAlert | AML monitoring alert |
| Problem | RFC 7807 error envelope |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Generated client compiles but auth fails. | Generator did not pick up OAuth security scheme. | Pass --security-scheme oauth2 flag; or wire token manually. |
| Swagger UI 404 on /api/docs. | OpenAPI sub-module not installed. | Install mfi_api_openapi; restart workers. |
| Spec missing endpoints from a newly installed module. | Spec cache stale. | Settings > Technical > Clear OpenAPI cache; or wait 5min auto-refresh. |
See also
Was this page helpful?

