This document describes the OpenAPI 3.0 specification implementation for SwiftRemit services.
SwiftRemit now provides machine-readable API specifications for both services:
- API Service (
api/): Currency configuration and anchor management - Backend Service (
backend/): Asset verification, KYC, and webhook handling
When running the services locally, Swagger UI documentation is available at:
- API Service: http://localhost:3000/api/docs
- Backend Service: http://localhost:3001/api/docs
Raw OpenAPI specifications are available at:
- API Service:
api/openapi.yaml - Backend Service:
backend/openapi.yaml
You can also access them via HTTP:
- http://localhost:3000/api/docs/openapi.json
- http://localhost:3000/api/docs/openapi.yaml
- http://localhost:3001/api/docs/openapi.json
- http://localhost:3001/api/docs/openapi.yaml
Use the OpenAPI specifications to generate client SDKs in various languages:
npx @openapitools/openapi-generator-cli generate \
-i api/openapi.yaml \
-g typescript-axios \
-o ./generated/api-clientopenapi-generator-cli generate \
-i backend/openapi.yaml \
-g python \
-o ./generated/backend-clientopenapi-generator-cli generate \
-i api/openapi.yaml \
-g java \
-o ./generated/api-client-javaOpenAPI Generator supports 50+ languages. See: https://openapi-generator.tech/docs/generators
Validate the OpenAPI specs manually:
# API Service
cd api
npm run validate:openapi
# Backend Service
cd backend
npm run validate:openapiThe OpenAPI specs are automatically validated in CI/CD pipelines:
- On every push to
mainordevelop - On every pull request
- Checks that specs are valid and up-to-date
See .github/workflows/openapi-validation.yml for details.
GET /health- Health check
GET /api/currencies- List all currenciesGET /api/currencies/{code}- Get currency by code
GET /api/anchors- List all anchors (with optional filtering)GET /api/anchors/{id}- Get anchor by IDPOST /api/anchors/admin- Create anchor (requires API key)
GET /health- Health check
GET /api/verification/{assetCode}/{issuer}- Get asset verification statusPOST /api/verification/verify- Trigger asset verificationPOST /api/verification/report- Report suspicious assetGET /api/verification/verified- List verified assetsPOST /api/verification/batch- Batch verification status
GET /api/kyc/status- Get KYC status (requires authentication)
POST /api/transfer- Initiate transfer (requires KYC approval)
POST /api/fx-rate- Store FX rateGET /api/fx-rate/{transactionId}- Get FX rate for transaction
POST /api/webhook- Receive webhook (requires signature verification)
- Admin endpoints require
x-api-keyheader
- User endpoints require
x-user-idheader - Webhook endpoints require signature headers:
x-signature: HMAC signaturex-timestamp: Request timestampx-nonce: Unique noncex-anchor-id: Anchor identifier
All endpoints return consistent error responses:
{
"success": false,
"error": {
"message": "Error description",
"code": "ERROR_CODE"
},
"timestamp": "2026-03-28T20:00:00.000Z"
}400- Bad Request (invalid input)401- Unauthorized (missing/invalid authentication)403- Forbidden (insufficient permissions)404- Not Found (resource doesn't exist)429- Too Many Requests (rate limit exceeded)500- Internal Server Error
Both services implement rate limiting:
- Default: 100 requests per 15 minutes per IP
- Configurable via environment variables:
RATE_LIMIT_WINDOW_MSRATE_LIMIT_MAX_REQUESTS
The OpenAPI specifications should be updated whenever:
- New endpoints are added
- Request/response schemas change
- Authentication requirements change
- Error codes are added or modified
- Validate before committing: Always run
npm run validate:openapibefore committing changes - Update examples: Keep example values realistic and helpful
- Document error cases: Include all possible error responses
- Version appropriately: Update version numbers for breaking changes
- Test with real clients: Generate and test client SDKs to ensure usability
- Swagger UI: Interactive API documentation
- Swagger Editor: https://editor.swagger.io/ (paste spec to edit)
- OpenAPI Generator: https://openapi-generator.tech/
- Postman: Import OpenAPI spec to create collections
- Insomnia: Import OpenAPI spec for API testing
For questions or issues with the API specifications:
- Check this documentation
- Review the OpenAPI spec files
- Test endpoints using Swagger UI
- Contact the SwiftRemit development team