OpenAPI specification

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

OpenAPI
OpenAPI documentation generated from Configuration → API.
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

  1. Open Postman, File > Import
  2. Choose Link, paste https://microfinance.mybridgeerp.com/api/openapi.json
  3. Import as Collection
  4. Set environment variable {{token}} via the OAuth helper
  5. Run any endpoint; the schema panel auto-validates request body

Worked scenarios

Scenario — Africa's Talking CI validates against MFI OpenAPI

Setting: Africa's Talking, an SMS gateway used by Mwananchi SACCO, runs a CI pipeline that validates its mock MFI webhook responses against the live MFI OpenAPI before merging changes.

CharacterRole
Samuel KibetMwananchi DevOps
Aisha HassanAfrica's Talking Integration Engineer

Timeline

  1. Day 1, 10:00: Aisha adds openapi.json fetch to CI. (GitHub Action pulls spec nightly.)
  2. Day 2, 09:00: Spec changes — new field added_via_api_key on loan responses. (Spec sha differs.)
  3. Day 2, 09:01: CI runs schema diff. (Diff posted to PR comment for review.)
  4. Day 2, 14:00: Aisha updates mock responses to match new field. (Mock tests pass.)
  5. 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

SchemaDescription
MemberFull member profile including KYC
MemberSummaryLite version for list endpoints
LoanFull loan with schedule embedded
LoanSummaryLite version
LoanScheduleLineOne row of repayment schedule
DisbursementDisbursement event
RepaymentRepayment event
SavingsAccountSavings account
SavingsTransactionSavings book entry
MobileMoneyTransactionM-Pesa/Airtel transaction
AMLAlertAML monitoring alert
ProblemRFC 7807 error envelope

Troubleshooting

SymptomLikely causeFix
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?