API Examples
This section provides code examples for integrating TucanAPI into your applications using various programming languages. Choose your preferred language to see detailed examples for each API endpoint.
All examples assume you have an API key. Replace YOUR_API_KEY
with your actual API key in the code examples.
Python
Examples using the Requests library to interact with TucanAPI endpoints.
View ExamplesJavaScript
Examples using the Fetch API and Node.js to interact with TucanAPI endpoints.
View ExamplesPHP
Examples using cURL and the Guzzle HTTP client to interact with TucanAPI endpoints.
View ExamplesCommon Use Cases
Currency Conversion
Convert an amount from one currency to another using the latest exchange rates.
Request
GET /rates/convert?from=EUR&to=USD&amount=100&api_key=YOUR_API_KEY
Response
{
"from": "EUR",
"to": "USD",
"amount": 100,
"result": 113.73,
"rate": 1.1373,
"date": "2025-04-30"
}
IP Geolocation Lookup
Get location information for an IP address.
Request
GET /ip-geolocation?ip=8.8.8.8&api_key=YOUR_API_KEY
Response
{
"ip": "8.8.8.8",
"country": "United States",
"country_code": "US",
"city": "Mountain View",
"latitude": 37.4056,
"longitude": -122.0775,
"timezone": "America/Los_Angeles"
}
Email Validation
Validate an email address and check for common typos.
Request
GET /[email protected]&api_key=YOUR_API_KEY
Response
{
"email": "[email protected]",
"is_valid": false,
"is_disposable": false,
"is_role_account": false,
"domain": "gnail.com",
"domain_suggestion": "gmail.com"
}
API Client Libraries
We provide official client libraries for several programming languages to make integrating with TucanAPI even easier.
Language | Package Manager | Installation | GitHub |
---|---|---|---|
Python | pip | pip install tucanapi |
tucanapi/tucanapi-python |
JavaScript | npm | npm install tucanapi |
tucanapi/tucanapi-js |
PHP | Composer | composer require tucanapi/tucanapi |
tucanapi/tucanapi-php |
Need Help with Integration?
Our support team is available to help you integrate TucanAPI into your application. If you have any questions or need assistance, don't hesitate to reach out.