API Reference
API Overview
RESTful API with JSON responses and comprehensive error handling
Base URL
All API requests should be made to the following base URL
https://api.carapis.com/v1
All requests require authentication via API key in the header:
Authorization: Bearer YOUR_API_KEY
API Features
Everything you need for customs duty calculations
REST API
Complete REST API with JSON responses and comprehensive endpoints.
Real-time Data
Access real-time customs duty rates and trade agreement data.
Global Coverage
API supports 200+ countries with comprehensive trade data.
High Performance
Fast API responses with high availability and reliability.
API Endpoints
Core endpoints for customs duty calculations
POST
/api/v1/calculate
Calculate customs duties for a product
Parameters:
originCountrydestinationCountryproductTypevalueweight
GET
/api/v1/countries
Get list of supported countries
Parameters:
limitoffsetregion
GET
/api/v1/rates/{country}
Get duty rates for a specific country
Parameters:
countryproductTypeagreement
GET
/api/v1/agreements
Get trade agreements between countries
Parameters:
origindestinationtype
Code Examples
Get started with our API using these examples
JavaScript Example
const response = await fetch('https://api.carapis.com/v1/calculate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ originCountry: 'US', destinationCountry: 'CA', productType: 'electronics', value: 1000, weight: 5 }) }); const result = await response.json(); console.log('Duty Rate:', result.dutyRate);
Python Example
import requests response = requests.post( 'https://api.carapis.com/v1/calculate', headers={ 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, json={ 'originCountry': 'US', 'destinationCountry': 'CA', 'productType': 'electronics', 'value': 1000, 'weight': 5 } ) result = response.json() print(f"Duty Rate: {result['dutyRate']}")