Calculate Tax
const url = 'https://indepai.app/api/v1/tax/calculate';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"countryCode":"PT","income":{"salary":0,"freelance":0,"dividends":0,"capitalGains":0,"rental":0,"other":0},"deductions":{"pension":0,"health":0,"education":0,"housing":0,"charity":0,"other":0},"specialProgramId":"nhr-portugal","filingStatus":"single","dependents":0}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://indepai.app/api/v1/tax/calculate \ --header 'Content-Type: application/json' \ --data '{ "countryCode": "PT", "income": { "salary": 0, "freelance": 0, "dividends": 0, "capitalGains": 0, "rental": 0, "other": 0 }, "deductions": { "pension": 0, "health": 0, "education": 0, "housing": 0, "charity": 0, "other": 0 }, "specialProgramId": "nhr-portugal", "filingStatus": "single", "dependents": 0 }'Calculate estimated tax liability for a given income and country
Request Body
Section titled “Request Body”object
Country for tax calculation
Example
PTobject
Annual salary income
Example
60000Annual freelance/self-employment income
Example
20000Annual dividend income
Example
5000Annual capital gains (can be negative)
Example
10000Annual rental income
Example
0Other taxable income
Example
0object
Pension contributions
Health insurance premiums
Education expenses
Housing deductions (mortgage interest, etc.)
Charitable donations
Other deductions
ID of special tax program to apply
Example
nhr-portugalTax filing status
Number of dependents
Responses
Section titled “Responses”Tax calculation result
object
object
Country name
Total gross income
Taxable income after deductions
Total deductions applied
object
Income tax amount
Capital gains tax amount
Dividend tax amount
Social security contributions
Other applicable taxes
Total tax liability
Effective tax rate (%)
Net income after taxes
Name of special program applied
Important notes and disclaimers
Comparison with standard taxation
object
Tax without special programs
Savings from special program
object
Legal disclaimer
Example
{ "success": true, "data": { "country": "Portugal", "totalGrossIncome": 95000, "taxableIncome": 85000, "totalDeductions": 10000, "taxBreakdown": { "incomeTax": 25000, "capitalGainsTax": 2800, "dividendTax": 1400, "socialSecurity": 5000, "otherTaxes": 0 }, "totalTax": 34200, "effectiveTaxRate": 36, "netIncome": 60800 }, "meta": { "disclaimer": "This is an estimate only. Consult a tax professional for accurate advice." }}Validation error
object
Always false for error responses
Error type
Machine-readable error code
Detailed validation errors
object
Path to the invalid field
Error message
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}