The KRA Portal module integrates with Kenya Revenue Authority's developer.go.ke API gateway, providing programmatic access to 22 KRA services through a unified Salami Gateway interface. Validate PINs, check tax compliance, generate payment references, file returns, and more -- all via simple REST calls.
Salami wraps 22 developer.go.ke APIs across six categories:
| Category | APIs | Description |
|---|---|---|
| Checkers | 13 | PIN validation, TCC checks, tax obligations, invoices, customs, exemptions, excise licenses |
| Payments | 3 | PRN generation for IT, Rental, and VAT withholding taxes |
| Compliance | 1 | Tax Compliance Certificate (TCC) applications |
| Registration | 1 | Individual KRA PIN registration |
| Returns | 2 | TOT (Turnover Tax) and NIL return filing |
| Customs | 1 | Customs declaration status checking |
| App Management | 1 | Credential testing and app listing |
Your Application
|
v
Salami Gateway API (Bearer token auth)
|
v
KRA App Credentials (per-app consumer key/secret)
|
v
developer.go.ke (OAuth2 client_credentials)
|
v
KRA Backend Systems
Each request flows through three layers:
KRA's developer.go.ke uses OAuth 2.0 Client Credentials grant:
Token generation (handled automatically by Salami):
POST https://sbx.kra.go.ke/v1/token/generate?grant_type=client_credentials
Authorization: Basic base64(consumer_key:consumer_secret)
Response:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi...",
"token_type": "Bearer",
"expires_in": 3600
}
Salami caches the token and refreshes it automatically with a 60-second safety buffer before expiry.
Each KRA integration is configured through a KRA App record. A single tenant can have multiple KRA Apps (e.g., one sandbox app for testing, one production app for live use).
| Type | Description | Required Credentials |
|---|---|---|
portal |
developer.go.ke APIs (checkers, payments, returns, etc.) | consumer_key, consumer_secret |
etims |
eTIMS OSCU integration | tin, bhf_id, dvc_srl_no, cmc_key |
| Field | Type | Description |
|---|---|---|
id |
integer | Auto-increment primary key |
name |
string | Descriptive name (e.g., "Production Portal") |
type |
string | portal or etims |
environment |
string | sandbox or production |
consumer_key |
string | OAuth consumer key from developer.go.ke |
consumer_secret |
string | OAuth consumer secret from developer.go.ke |
tin |
string | Taxpayer Identification Number (eTIMS only) |
bhf_id |
string | Branch ID (eTIMS only) |
dvc_srl_no |
string | Device serial number (eTIMS only) |
cmc_key |
string | CMC key (eTIMS only) |
is_active |
boolean | Whether the app is currently active |
settings |
JSON | Additional configuration (optional) |
last_used_at |
timestamp | Last API call timestamp |
| Environment | Base URL | Purpose |
|---|---|---|
| Sandbox | https://sbx.kra.go.ke |
Testing and development |
| Production | https://api.kra.go.ke |
Live KRA operations |
Each KRA App has its own environment setting. To test:
environment: sandbox and sandbox credentials from developer.go.keenvironment: production and production credentialsImportant: Sandbox and production credentials are different. You cannot use sandbox credentials with the production endpoint or vice versa.
Read-only validation and lookup services. No side effects on KRA systems.
Generate Payment Reference Numbers (PRNs) for withholding tax remittance.
Tax Compliance Certificate management.
New taxpayer registration.
Tax return filing.
Customs and border operations.
All KRA Portal API requests go through your Salami tenant:
https://yourtenant.salami.dgl.co.ke/api/kra/
| Scope | Description | Endpoints |
|---|---|---|
kra:apps |
List and test KRA app configurations | App management |
kra:checkers |
PIN validation, TCC checks, invoice lookup, customs, exemptions | All 13 checker endpoints |
kra:payments |
Generate PRNs for withholding taxes | IT, Rental, VAT withholding |
kra:compliance |
Apply for Tax Compliance Certificates | TCC application |
kra:registration |
Register new KRA PINs | PIN registration |
kra:returns |
File TOT and NIL tax returns | TOT filing, NIL returns |
| Group | Included Scopes |
|---|---|
kra_full |
All 6 KRA scopes |
kra_read_only |
kra:apps, kra:checkers |
{
"success": false,
"message": "Your API token does not have the required permissions to access this endpoint.",
"error": "insufficient_scope",
"required_route": "api.kra.checkers.pin",
"your_scopes": ["kra:apps"]
}
{
"success": false,
"message": "KRA API error: Invalid PIN format",
"error": "kra_error",
"kra_response": {
"errorCode": "400",
"errorMessage": "Invalid PIN format"
}
}
| Status | Error | Resolution |
|---|---|---|
401 |
Invalid or expired Salami token | Regenerate your API token |
403 |
Missing required scope | Add the necessary scope to your token |
422 |
Validation error (missing fields) | Check required fields in the request body |
502 |
KRA server unreachable | Retry later; KRA may be under maintenance |
503 |
KRA token generation failed | Verify consumer key/secret are correct |
Back to: Getting Started | eTIMS API | Account Tokens