Skip to Content
C-Tax v1.0 is now available
API ReferenceC-Tax API Documentation

C-Tax API Documentation

Welcome to the C-Tax API documentation. C-Tax is a comprehensive tax compliance and transaction management system designed to integrate with Kenya Revenue Authority’s (KRA) eTIMS/VSCU system.

Overview

C-Tax provides a complete solution for businesses to automate tax compliance, manage transactions, and integrate seamlessly with KRA’s electronic Tax Invoice Management System (eTIMS).

Key Features

  • Automated KRA Integration - Direct VSCU connectivity for real-time tax compliance
  • Multi-Branch Support - Manage multiple business locations from a single account
  • Transaction Management - Sales, purchases, stock movements, and imports
  • Async Processing - Queue-based processing for high-volume transactions
  • Webhook Notifications - Real-time event notifications via webhooks
  • Comprehensive API - RESTful API for seamless integration with existing systems

Base URL

https://your-domain.com/api/v1

All API requests should be prefixed with this base URL.

Authentication

All endpoints require API key authentication via the Authorization header:

Authorization: Bearer YOUR_API_KEY

Your API key is generated when your client account is approved. Keep it secure and never expose it in client-side code.

See Authentication for detailed information.

Environments

C-Tax supports two environments:

EnvironmentURL PrefixDescription
Live/api/v1/Production transactions submitted to KRA
Sandbox/sandbox/api/v1/Test environment for development

API Endpoints Overview

Core Transaction APIs

EndpointMethodDescription
/salesPOSTCreate sales transaction
/sales/{id}GETGet sale details
/sales/searchPOSTSearch sales
/purchasesPOSTCreate purchase transaction
/purchases/{id}GETGet purchase details
/purchases/searchPOSTSearch purchases
/stockPOSTRecord stock movement
/stockGETList stock movements

Management APIs

EndpointMethodDescription
/branchesGET/POSTManage branches
/branches/{bhfId}GET/PUT/DELETEBranch operations
/branches/{bhfId}/statsGETBranch statistics
/devicesGET/POSTManage VSCU devices
/devices/{bhfId}/initializePOSTInitialize device
/devices/{bhfId}/testPOSTTest device connection

Reference Data APIs

EndpointMethodDescription
/codesGETList all code classifications
/codes/syncPOSTSync codes from KRA
/codes/tax-typesGETGet tax type codes
/codes/payment-typesGETGet payment type codes
/codes/countriesGETGet country codes

Supporting APIs

EndpointMethodDescription
/itemsGET/POSTManage items
/items/{itemCode}GETGet item details
/transactionsGETList all transactions
/transactions/{id}GETGet transaction details
/transactions/{id}/retryPOSTRetry failed transaction
/transactions/statsGETTransaction statistics
/webhooksGET/POSTManage webhooks
/noticesGETList KRA notices
/notices/syncPOSTSync notices from KRA
/imports/select-itemsPOSTFetch import items
/imports/update-itemsPOSTUpdate import status
/insurancesGET/POSTManage branch insurances

Standard Response Format

Success Response

{ "status": "success", "message": "Operation completed successfully", "data": { // Response data }, "meta": { "timestamp": "2025-01-15T14:30:00Z", "request_id": "req_abc123" } }

Error Response

{ "status": "error", "message": "Human-readable error message", "errors": { "field_name": ["Validation error message"] }, "meta": { "timestamp": "2025-01-15T14:30:00Z", "request_id": "req_abc123" } }

Pagination

List endpoints support pagination:

{ "data": [...], "meta": { "current_page": 1, "per_page": 50, "total": 156, "total_pages": 4 } }

Date/Time Formats

FormatExampleUsage
Date (YYYYMMDD)20250115Transaction dates
Time (HHMMSS)143000Transaction times
DateTime (YYYYMMDDHHmmss)20250115143000Last request dates
ISO 86012025-01-15T14:30:00ZAPI responses

HTTP Status Codes

CodeDescription
200Success - Request completed
201Created - Resource created
202Accepted - Async processing started
400Bad Request - Invalid request data
401Unauthorized - Invalid or missing API key
403Forbidden - Insufficient permissions
404Not Found - Resource not found
422Unprocessable Entity - Validation failed
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Rate Limiting

  • 60 requests per minute per API key
  • Rate limit headers included in responses:
    • X-RateLimit-Limit: Maximum requests allowed
    • X-RateLimit-Remaining: Requests remaining
    • X-RateLimit-Reset: Time until limit resets

Async Processing

For high-volume transactions, use async processing:

POST /api/v1/sales?async=true

Returns 202 Accepted with transaction ID:

{ "status": "processing", "message": "Transaction is being processed", "data": { "transaction_id": "uuid-here", "status": "pending" }, "meta": { "check_status_url": "/api/v1/transactions/{id}" } }

Use webhooks for real-time status updates or poll the transaction endpoint.

Tax Types

C-Tax supports Kenya’s tax classification system:

CodeNameRateDescription
AStandard Rate16%Standard VAT rate
BExempt0%VAT exempt items
CSpecial0%Special category
DZero-rated0%Zero-rated supplies
ESpecial Exemption0%Special exemption

Transaction Types

TypeDescription
salesSales to customers
purchasePurchases from suppliers
stockStock movements (in/out/adjustment)
importImported items

Transaction Statuses

StatusDescription
pendingTransaction created, awaiting processing
processingBeing sent to KRA/VSCU
successSuccessfully processed by KRA
failedProcessing failed (can retry)

Quick Start

1. Get API Credentials

After your account is approved, you’ll receive your API key.

2. Configure VSCU Device

// Create and initialize device await axios.post('/api/v1/devices', { bhf_id: '00', tin: 'YOUR_TIN', dvc_srl_no: 'DEVICE_SERIAL', vscu_url: 'VSCU_URL' }); await axios.post('/api/v1/devices/00/initialize');

3. Sync Reference Data

// Sync codes from KRA await axios.post('/api/v1/codes/sync', { bhf_id: '00' });

4. Submit Your First Sale

const sale = await axios.post('/api/v1/sales', { branch_id: '00', invoice_no: 'INV-001', sale_date: '20250115', sale_time: '143000', payment_type: 'CASH', customer_name: 'John Doe', items: [{ item_sequence: 1, item_code: 'ITEM001', item_name: 'Product A', quantity: 2, unit_price: 1000, supply_amount: 2000, tax_type: 'A', tax_rate: 16, tax_amount: 320, total_amount: 2320 }] });

SDKs and Tools

  • Postman Collection - Available on request
  • PHP SDK - Coming soon
  • JavaScript SDK - Coming soon

Support

  • Documentation Issues - Report on GitHub
  • API Support - support@c-tax.ke
  • Emergency Support - Contact your account manager

Next Steps

Last updated on