@extends('layouts.admin') @section('title', 'API Documentation') @section('content')
{{ url('/api/v1') }}
Most endpoints require API key authentication:
Authorization: Bearer YOUR_API_KEY
{
"success": true,
"data": { ... },
"message": "Operation successful"
}
{
"success": false,
"error": "Error message",
"code": 400
}
/api/v1/tax-calculate
Public
Calculate import taxes for goods based on HS code, value, and other parameters.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
hs_code |
string | Yes | HS Code of the product | 870321 |
cif_value |
number | Yes | CIF value in KES | 1500000 |
country_of_origin |
string | Yes | ISO country code | CN |
weight_kg |
number | Optional | Weight in kilograms | 1500 |
description |
string | Optional | Product description | Passenger vehicles |
currency |
string | Optional | Currency code (default: KES) | USD |
GET {{ url('/api/v1/tax-calculate') }}?hs_code=870321&cif_value=1500000&country_of_origin=CN&weight_kg=1500
{
"success": true,
"data": {
"calculation_id": "calc_123456",
"hs_code": "870321",
"description": "Passenger motor vehicles",
"cif_value": 1500000,
"country_of_origin": "CN",
"tax_breakdown": {
"import_duty": {
"rate": 25,
"amount": 375000,
"type": "percentage"
},
"vat": {
"rate": 16,
"amount": 300000,
"base": 1875000
},
"excise_duty": {
"rate": 20,
"amount": 375000,
"applicable": true
}
},
"total_taxes": 1050000,
"total_payable": 2550000,
"calculation_steps": [...],
"timestamp": "2024-01-15T10:30:00Z"
},
"message": "Tax calculation completed successfully"
}
/api/v1/hs-codes
Public
Retrieve all HS codes with their tax configurations.
| Parameter | Type | Required | Description |
|---|---|---|---|
search |
string | Optional | Search by HS code or description |
page |
integer | Optional | Page number for pagination |
per_page |
integer | Optional | Items per page (default: 20) |
{
"success": true,
"data": {
"data": [
{
"hs_code": "870321",
"description": "Passenger motor vehicles",
"default_duty_type": "percentage",
"default_duty_value": 25,
"excise_applicable": true,
"sensitive": false
}
],
"current_page": 1,
"total": 1500
}
}
/api/v1/hs-codes/{code}
Public
Retrieve detailed information for a specific HS code.
GET {{ url('/api/v1/hs-codes/870321') }}
{
"success": true,
"data": {
"hs_code": "870321",
"description": "Passenger motor vehicles with spark-ignition engine",
"default_duty_type": "percentage",
"default_duty_value": 25,
"excise_applicable": true,
"excise_formula": {
"rate": 20,
"minimum": 0
},
"sensitive": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"benchmarks": [...],
"country_overrides": [...]
}
}
/api/v1/countries
Public
Get list of supported countries with their codes and trade agreements.
{
"success": true,
"data": [
{
"code": "CN",
"name": "China",
"region": "Asia",
"trade_agreement": "none"
}
]
}
/api/v1/currencies
Public
Get supported currencies and their current exchange rates.
{
"success": true,
"data": [
{
"code": "USD",
"name": "US Dollar",
"exchange_rate": 157.50,
"updated_at": "2024-01-15T10:00:00Z"
}
]
}
/api/v1/exchange-rates
Public
Get current exchange rates against KES.
/api/v1/bulk-calculate
Authenticated
Perform multiple tax calculations in a single request.
{
"calculations": [
{
"hs_code": "870321",
"cif_value": 1500000,
"country_of_origin": "CN",
"weight_kg": 1500
},
{
"hs_code": "030211",
"cif_value": 500000,
"country_of_origin": "JP",
"weight_kg": 1000
}
]
}
Authorization: Bearer your_api_key_here
/api/v1/calculation-history
Authenticated
Retrieve calculation history for your account.
| Parameter | Type | Required | Description |
|---|---|---|---|
date_from |
string | Optional | Filter from date (YYYY-MM-DD) |
date_to |
string | Optional | Filter to date (YYYY-MM-DD) |
| Code | Message | Description |
|---|---|---|
| 400 | Bad Request | Invalid parameters or missing required fields |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | API key doesn't have permission for this endpoint |
| 404 | Not Found | HS code or resource not found |
| 422 | Unprocessable Entity | Validation errors in request data |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error |
429 Too Many Requests responses.