Complete reference for integrating with AI Tax Analyst SA APIs
Base URL: https://your-domain.replit.app/api
Content-Type: application/json
All API responses include a success boolean field and relevant data or error messages.
Calculate Pay-As-You-Earn tax for individual taxpayers based on annual salary.
| Parameter | Type | Required | Description |
|---|---|---|---|
annual_salary |
number | Yes | Annual salary in Rands (e.g., 500000) |
age |
number | No | Age of taxpayer (affects rebates) |
tax_year |
string | No | Tax year (default: 2025/2026) |
{
"annual_salary": 500000,
"age": 35,
"tax_year": "2025/2026"
}
{
"success": true,
"calculation": {
"annual_salary": 500000.0,
"gross_tax": 112532.0,
"net_tax": 95297.0,
"rebates_applied": 17235,
"net_annual_salary": 404703.0,
"monthly": {
"gross_salary": 41666.67,
"tax": 7941.42,
"net_salary": 33725.25
},
"rates": {
"effective_rate": 19.06,
"marginal_rate": 31.0
},
"tax_year": "2025/2026",
"calculation_date": "2025-09-24"
}
}
import requests
url = "https://your-domain.replit.app/api/calculate-paye"
data = {
"annual_salary": 500000,
"age": 35
}
response = requests.post(url, json=data)
result = response.json()
if result["success"]:
calc = result["calculation"]
print(f"Monthly Tax: R{calc['monthly']['tax']:,.2f}")
print(f"Net Salary: R{calc['monthly']['net_salary']:,.2f}")
const response = await fetch('https://your-domain.replit.app/api/calculate-paye', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
annual_salary: 500000,
age: 35
})
});
const result = await response.json();
if (result.success) {
console.log(`Monthly Tax: R${result.calculation.monthly.tax}`);
}
curl -X POST https://your-domain.replit.app/api/calculate-paye \
-H "Content-Type: application/json" \
-d '{"annual_salary": 500000, "age": 35}'
Calculate corporate income tax for South African companies.
| Parameter | Type | Required | Description |
|---|---|---|---|
taxable_income |
number | Yes | Company's taxable income in Rands |
company_type |
string | No | Type: "normal", "sbc" (Small Business Corporation), "micro" |
{
"taxable_income": 1000000,
"company_type": "normal"
}
{
"success": true,
"calculation": {
"taxable_income": 1000000.0,
"tax_rate": 27.0,
"tax_amount": 270000.0,
"net_income": 730000.0,
"company_type": "normal",
"effective_rate": 27.0
}
}
Calculate VAT amounts for transactions at the standard 15% rate.
| Parameter | Type | Required | Description |
|---|---|---|---|
amount |
number | Yes | Amount in Rands |
vat_inclusive |
boolean | No | Whether amount includes VAT (default: false) |
vat_rate |
number | No | VAT rate percentage (default: 15) |
{
"amount": 1000,
"vat_inclusive": false
}
{
"success": true,
"calculation": {
"amount_excl_vat": 1000.0,
"vat_amount": 150.0,
"amount_incl_vat": 1150.0,
"vat_rate": 15.0
}
}
Intelligent routing system that automatically determines whether to perform calculations, search the knowledge base, or provide AI-generated responses based on query intent.
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | Yes | Natural language query about SA tax |
context |
object | No | Additional context for the query |
{
"query": "What are the PAYE tax brackets for 2025?"
}
{
"success": true,
"intent": "qa",
"confidence": 0.95,
"result": {
"answer": "For the 2025/2026 tax year, the PAYE tax brackets are...",
"sources": [
{
"source": "SARS Tax Tables 2025/2026",
"similarity": 0.89,
"text": "Tax bracket information..."
}
],
"confidence": 0.85
}
}
Upload and analyze tax documents using AI to extract key information and provide insights.
This endpoint accepts multipart/form-data for file uploads.
| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | PDF or text document (max 10MB) |
analysis_type |
string | No | Type: "summary", "extract", "compliance" |
import requests
url = "https://your-domain.replit.app/api/analyze-document"
files = {'file': open('tax_return.pdf', 'rb')}
data = {'analysis_type': 'summary'}
response = requests.post(url, files=files, data=data)
result = response.json()
{
"success": true,
"analysis": {
"document_type": "Tax Return",
"key_information": {
"tax_year": "2024/2025",
"taxpayer_type": "Individual",
"total_income": 650000
},
"summary": "This document is an individual tax return...",
"compliance_notes": [],
"recommendations": []
}
}
Search through the tax knowledge base including legislation, guides, and interpretation notes.
| Parameter | Type | Required | Description |
|---|---|---|---|
q |
string | Yes | Search query |
category |
string | No | Filter: "legislation", "guides", "interpretation" |
limit |
number | No | Maximum results (default: 10, max: 50) |
GET /api/search?q=provisional+tax&category=guides&limit=5
{
"success": true,
"results": [
{
"document_id": 5,
"title": "Guide to Provisional Tax",
"category": "guides",
"relevance": 0.92,
"excerpt": "Provisional tax is a method of paying tax...",
"tax_year": "2025"
}
],
"total_results": 5
}
Direct AI-powered Q&A endpoint using RAG (Retrieval Augmented Generation) for accurate tax-related questions with source citations.
| Parameter | Type | Required | Description |
|---|---|---|---|
question |
string | Yes | Tax-related question (5-500 characters) |
{
"question": "How do I claim home office expenses?"
}
{
"success": true,
"answer": "To claim home office expenses in South Africa, you must meet specific SARS requirements...",
"sources": [
{
"source": "SARS Home Office Guide",
"similarity": 0.92,
"text": "Home office expenses can be claimed if..."
}
],
"question": "How do I claim home office expenses?",
"response_time": 1.234
}
This endpoint is limited to 20 requests per hour per IP address.
Retrieve a list of available documents in the knowledge base.
| Parameter | Type | Required | Description |
|---|---|---|---|
category |
string | No | Filter by category |
processed |
boolean | No | Filter by processing status |
{
"success": true,
"documents": [
{
"id": 1,
"filename": "income_tax_act.pdf",
"category": "Legislation",
"processed": true,
"page_count": 450,
"upload_date": "2025-09-01"
}
],
"total": 25
}
All API endpoints return consistent error responses:
{
"success": false,
"error": "Error message describing the issue",
"code": "ERROR_CODE",
"details": {} // Optional additional error details
}
| HTTP Status | Error Code | Description |
|---|---|---|
400 |
INVALID_REQUEST | Missing or invalid parameters |
404 |
NOT_FOUND | Resource not found |
413 |
FILE_TOO_LARGE | Uploaded file exceeds size limit |
429 |
RATE_LIMIT | Too many requests |
500 |
INTERNAL_ERROR | Server error |
API endpoints have the following rate limits to ensure fair usage:
| Endpoint Type | Rate Limit | Window |
|---|---|---|
| Calculation APIs | 100 requests | per minute |
| AI Query APIs | 30 requests | per minute |
| Document Analysis | 10 requests | per minute |
| Search APIs | 60 requests | per minute |
Rate limit information is included in response headers:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Unix timestamp when limit resetsGet started quickly with our API using these code examples:
# Install: pip install requests
import requests
class TaxAnalystAPI:
def __init__(self, base_url):
self.base_url = base_url
self.session = requests.Session()
def calculate_paye(self, annual_salary, age=None):
"""Calculate PAYE tax for an individual"""
data = {"annual_salary": annual_salary}
if age:
data["age"] = age
response = self.session.post(
f"{self.base_url}/api/calculate-paye",
json=data
)
return response.json()
def query_ai(self, question):
"""Ask a tax-related question"""
response = self.session.post(
f"{self.base_url}/api/universal",
json={"query": question}
)
return response.json()
# Usage
api = TaxAnalystAPI("https://your-domain.replit.app")
result = api.calculate_paye(500000, age=35)
print(f"Monthly net salary: R{result['calculation']['monthly']['net_salary']:,.2f}")
// Install: npm install axios
const axios = require('axios');
class TaxAnalystAPI {
constructor(baseUrl) {
this.baseUrl = baseUrl;
}
async calculatePAYE(annualSalary, age = null) {
const data = { annual_salary: annualSalary };
if (age) data.age = age;
const response = await axios.post(
`${this.baseUrl}/api/calculate-paye`,
data
);
return response.data;
}
async queryAI(question) {
const response = await axios.post(
`${this.baseUrl}/api/universal`,
{ query: question }
);
return response.data;
}
}
// Usage
const api = new TaxAnalystAPI('https://your-domain.replit.app');
api.calculatePAYE(500000, 35).then(result => {
console.log(`Monthly tax: R${result.calculation.monthly.tax}`);
});
Our API is designed to be simple and intuitive. If you need assistance:
Review this comprehensive API documentation
Check the code examples for your language
Contact our technical support team
This API provides tax calculation and information services based on South African tax legislation. All calculations and information are provided for general guidance only. Users should verify all information with SARS and consult qualified tax professionals for specific advice. The API maintainers accept no liability for decisions made based on the information provided.