Skip to main content

Score Request API

Overview

The Score Request API allows you to request credit scores and related financial products. This endpoint processes customer information and returns scoring results based on the selected product type.

Endpoint

POST https://api.kamoa.io/score/request
info

This endpoint processes customer information and returns scoring results based on the selected product type.

Authentication

For detailed instructions, see the Authentication Guide.

  • Authorization: token
  • x-api-key: Your API key
Security Note

Never expose API keys in client-side code

cURL Example
curl -X POST https://api.kamoa.io/score/request \
-H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "x-api-key: secret_IPU5xWuAwimnyTGLlPGaCw8AY..." \
-H "Content-Type: application/json"

Request Headers

HeaderRequiredDescription
Content-TypeYesMust be application/json
AuthorizationYestoken for authentication
x-api-keyYesYour API key for additional security

Request Body

Required Fields

FieldTypeDescriptionValidation
nationalIdstringCustomer's national ID numberRequired, non-empty
phoneNumberstringCustomer's phone numberRequired, must be valid international format
firstNamestringCustomer's first nameRequired, non-empty
lastNamestringCustomer's last nameRequired, non-empty
productCodeenumProduct type to requestMust be one of the available product codes

Optional Fields

FieldTypeDescriptionValidation
emailstringCustomer's email addressOptional, valid email format if provided
streetstringStreet addressOptional
citystringCityOptional
countrystringCountryOptional
middleNamestringCustomer's middle nameOptional
kraPinstringKenya Revenue Authority PINOptional
dobstringDate of birthOptional, ISO date format
augmentbooleanAugment analysis with extra datasetsOptional, default false
documentsDetailsarrayList of documents with detailsRequired for statement-based products

Document Details Object

FieldTypeDescriptionValidation
namestringDocument file nameRequired
typeenumType of document to analyzeRequired (MPESA_STATEMENT, BANK_STATEMENT, etc.)
passwordstringPassword for protected statementsRequired for M-Pesa statements
bankNameenumBank name (UPPERCASE with underscores)Required for bank statements

Upload Response & Document Upload

After submitting a request with documents, the API returns pre-signed upload URLs for each document. Use these URLs to upload your files.

Example Response

{
"message": "Request submitted successfully",
"requestId": "cd81b45e-2ad4-4ec4-977d-712eb0275508",
"documents": [
{
"documentName": "foimpesa.pdf",
"documentType": "MPESA_STATEMENT",
"url": "https://...",
"expiresAt": "2025-08-25T11:59:10.449Z"
},
{
"documentName": "Mercy_loop.pdf",
"documentType": "BANK_STATEMENT",
"url": "https://...",
"expiresAt": "2025-08-25T11:59:10.481Z"
}
],
"totalDocuments": 2
}

How to Upload

  1. Match local files to the response: Use the documentName field to identify which local file maps to which pre-signed url.
  2. Perform a direct upload: Send an HTTP PUT request to the url with the raw file bytes.
cURL Upload Example
curl -X PUT "https://..." \
-H "Content-Type: application/pdf" \
--data-binary @foimpesa.pdf
  1. Repeat for each document until all uploads are complete.
  2. Ensure timing: Uploads must be completed before the expiresAt timestamp.

Product Codes

Parsing

CodeNameDescriptionRequirements
PAExtract & AuthenticateExtracts headers and transactions, validates statement authenticity. Returns structured data (CSV/JSON)Statement PDF required
PASKamoaLiteExtract & Authenticate + provides risk score and credit limit for quick underwriting decisionsStatement PDF required
PARSKamoa360KamoaLite + detailed financial behavior signals (income volatility, lifestyle, spend stability)Statement PDF required

Score

CodeNameDescriptionRequirements
P7Bundle 1CIK Report + Bundle 1
P8Bundle 2Bundle 1 + KamoaLite (CIK report + boosted score + cash flow analysis)Statement PDF

... (rest of doc unchanged) |

Product Codes

Parsing

CodeNameDescriptionRequirements
PAExtract & AuthenticateExtracts headers and transactions, validates statement authenticity. Returns structured data (CSV/JSON)Statement PDF required
PASKamoaLiteExtract & Authenticate + provides risk score and credit limit for quick underwriting decisionsStatement PDF required
PARSKamoa360KamoaLite + detailed financial behavior signals (income volatility, lifestyle, spend stability)Statement PDF required

Score

CodeNameDescriptionRequirements
P7Bundle 1CIK Report + Bundle 1
P8Bundle 2Bundle 1 + KamoaLite(CIK report + boosted score + cash flow analysis)Statement PDF

Use Cases by Product

For Credit Analysts & Data Scientists

  • Extract & Authenticate: Raw transaction data for building custom decision models
  • Kamoa360: Comprehensive financial behavior analysis with 100+ cash flow features

For Underwriters & Quick Decisions

  • KamoaLite: Instant risk scoring and credit limit recommendations
  • Bundle 1: Enhanced scoring combining traditional and alternative data
  • Bundle 2: Complete credit assessment with all available data sources

Supported Document Types

TypeDescriptionAdditional Requirements
MPESA_STATEMENTM-Pesa transaction statementRequires password
MPESA_TILL_STATEMENTM-Pesa till statementRequires password
BANK_STATEMENTBank account statementRequires bankName

Supported Banks

Bank CodeBank Name
KCBKenya Commercial Bank
Equity BankEquity Bank
NCBANCBA Bank
NCBA LoopNCBA Loop
Absa Bank KenyaAbsa Bank Kenya
Diamond Trust BankDiamond Trust Bank
Stanbic Bank KenyaStanbic Bank Kenya
Standard Chartered Bank KenyaStandard Chartered Bank Kenya
I & M BankI&M Bank
Prime BankPrime Bank
Branch MicrofinanceBranch Microfinance
Family BankFamily Bank

Validation Rules

Conditional Requirements

Important Validation Rules
  1. Document Type Requirement: For statement-based product codes (PA, PAS, PARS, P8), the documentType field is required.

  2. M-Pesa Statement Requirements: When documentType is MPESA_STATEMENT or MPESA_TILL_STATEMENT, the password field is required.

  3. Bank Statement Requirements: When documentType is BANK_STATEMENT, the bankName field is required.

Example Requests

Extract & Authenticate Request

POST /score/request - Extract & Authenticate Product (Multi-Document)
{
"nationalId": "12345678",
"phoneNumber": "+254712345678",
"firstName": "John",
"lastName": "Doe",
"productCode": "PA",
"documents": [
{
"documentType": "MPESA_STATEMENT",
"documentName": "mpesa_statement.pdf",
"password": "mpesa_password_123"
}
]
}

KamoaLite Request

POST /score/request - KamoaLite Product (Multi-Document)
{
"nationalId": "12345678",
"phoneNumber": "+254712345678",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"middleName": "Smith",
"productCode": "PAS",
"documents": [
{
"documentType": "BANK_STATEMENT",
"documentName": "bank_statement.pdf",
"bankName": "KCB",
"accountNumber": "1234567890"
}
]
}

Bundle 2 Request

POST /score/request - Bundle 2 Product (Multi-Document)
{
"nationalId": "12345678",
"phoneNumber": "+254712345678",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"middleName": "Smith",
"street": "123 Main Street",
"city": "Nairobi",
"country": "Kenya",
"kraPin": "A123456789B",
"dob": "1990-01-15",
"productCode": "P8",
"documents": [
{
"documentType": "BANK_STATEMENT",
"documentName": "equity_statement.pdf",
"bankName": "EQUITY_BANK",
"accountNumber": "9876543210"
}
]
}

Bundle 1 Request

POST /score/request - Bundle 1 Product (Multi-Document)
{
"nationalId": "12345678",
"phoneNumber": "+254712345678",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"middleName": "Smith",
"street": "123 Main Street",
"city": "Nairobi",
"country": "Kenya",
"productCode": "P7",
"documents": []
}

Response Format

Success Response (200 OK)

Multi-Document Success Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"requestId": "req_1234567890abcdef",
"uploadUrls": [
{
"documentName": "mpesa_statement.pdf",
"url": "https://...",
"expiresAt": "2024-06-10"
},
{
"documentName": "bank_statement.pdf",
"url": "https://...",
"expiresAt": "2024-06-10"
}
]
}

Error Responses

Validation Error (400 Bad Request)

400 Bad Request
{
"success": false,
"error": "ValidationError",
"message": "Request validation failed",
"details": [
{
"field": "phoneNumber",
"message": "Invalid phone number"
},
{
"field": "documentType",
"message": "Document type is required for statement-based products"
}
]
}

Authentication Error (401 Unauthorized)

401 Unauthorized
{
"success": false,
"error": "AuthenticationError",
"message": "Invalid or expired authentication token"
}

Rate Limit Error (429 Too Many Requests)

429 Too Many Requests
{
"success": false,
"error": "RateLimitError",
"message": "Too many requests. Please try again later.",
"retryAfter": 60,
"quotaRemaining": 847,
"resetTime": "2025-06-10T15:30:00Z"
}

Error Codes

HTTP StatusError TypeDescriptionCommon Causes
400ValidationErrorRequest data validation failedMissing required fields, invalid format
401AuthenticationErrorInvalid or missing authenticationExpired token, missing API key
403AuthorizationErrorInsufficient permissionsInvalid API key, plan restrictions
429RateLimitErrorRate or quota limit exceededToo many requests, daily quota reached
500InternalServerErrorServer-side processing errorTemporary service issues
Rate Limit Handling

When you receive a 429 error, check the retryAfter header and implement exponential backoff to avoid further rate limiting.

Best Practices

Product Selection Guide

Choose the right product for your use case:

  • Need raw transaction data? → Use Extract & Authenticate
  • Need quick credit decisions? → Use KamoaLite or Bundle 1
  • Need detailed behavioral analysis? → Use Kamoa360
  • Need comprehensive assessment? → Use Bundle 2 (when available)

Phone Number Format

Always provide phone numbers in international format with country code:

+ Correct: "+254712345678"
- Incorrect: "0712345678"

Data Validation

Validate all required fields on the client side before making API calls to reduce errors and improve user experience.