
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
aircall-api
Advanced tools
A Python client library for the Aircall.io API, providing easy access to Aircall's telephony services.
pip install aircall-api
Or using uv:
uv add aircall-api
from aircall import AircallClient
# Initialize the client
client = AircallClient(
api_id="your_api_id",
api_token="your_api_token"
)
# List phone numbers
numbers = client.number.list()
# Get a specific number
number = client.number.get(12345)
To use this library, you'll need your Aircall API credentials:
client = AircallClient(
api_id="YOUR_API_ID",
api_token="YOUR_API_TOKEN",
timeout=30, # Optional: request timeout in seconds
verbose=False # Optional: enable debug logging
)
The library provides access to the following Aircall API resources:
# List all calls
calls = client.call.list(page=1, per_page=20)
# Get a specific call
call = client.call.get(call_id=12345)
# Search for calls
calls = client.call.search(from_date="2024-01-01", to_date="2024-01-31")
# List all contacts
contacts = client.contact.list()
# Create a new contact
contact = client.contact.create(
first_name="John",
last_name="Doe",
phone_numbers=[{"label": "Work", "value": "+1234567890"}],
emails=[{"label": "Office", "value": "john.doe@example.com"}]
)
# Update a contact
client.contact.update(
contact_id=12345,
emails=[{"label": "Personal", "value": "john@example.com"}]
)
# Search for contacts
contacts = client.contact.search(phone_number="+1234567890")
# List all numbers
numbers = client.number.list()
# Get a specific number
number = client.number.get(number_id=12345)
The library provides custom exceptions for different error scenarios. All exceptions inherit from AircallError:
from aircall import (
AircallClient,
ValidationError,
AuthenticationError,
NotFoundError,
UnprocessableEntityError,
RateLimitError,
ServerError,
AircallConnectionError,
AircallTimeoutError,
)
client = AircallClient(api_id="your_id", api_token="your_token")
try:
contact = client.contact.get(12345)
except NotFoundError:
print("Contact not found")
except AuthenticationError:
print("Invalid API credentials")
except RateLimitError as e:
print(f"Rate limit exceeded. Retry after {e.retry_after} seconds")
except ValidationError as e:
print(f"Invalid request: {e.message}")
except AircallTimeoutError:
print("Request timed out")
except AircallConnectionError:
print("Failed to connect to Aircall API")
ValidationError (400) - Invalid request payload or bad requestAuthenticationError (401, 403) - Invalid API credentialsNotFoundError (404) - Resource not foundUnprocessableEntityError (422) - Server unable to process the requestRateLimitError (429) - Rate limit exceeded (includes retry_after attribute)ServerError (5xx) - Aircall server errorAircallConnectionError - Network connection failedAircallTimeoutError - Request timed outAll exceptions include:
message: Error descriptionstatus_code: HTTP status code (for API errors)response_data: Full error response from the API (if available)The Aircall SDK includes comprehensive logging capabilities to help you debug issues, monitor API requests, and track application behavior.
Enable debug logging with the verbose parameter:
from aircall import AircallClient
# Enable verbose logging (sets log level to DEBUG)
client = AircallClient(
api_id="your_api_id",
api_token="your_api_token",
verbose=True # Enables DEBUG level logging
)
# Now all API requests/responses will be logged
numbers = client.number.list()
For more control, configure logging manually using Python's standard logging module:
import logging
from aircall import AircallClient, configure_logging
# Configure logging for the entire SDK
configure_logging(logging.INFO)
# Or configure logging for specific components
logging.getLogger('aircall.client').setLevel(logging.DEBUG)
logging.getLogger('aircall.resources').setLevel(logging.INFO)
client = AircallClient(api_id="your_id", api_token="your_token")
DEBUG: Detailed request/response information
Request: GET https://api.aircall.io/v1/numbers?page=1INFO: High-level operation information
Aircall client initializedWARNING: Important events that may need attention
API error: 404 GET /calls/999 - Not Found (took 0.34s)ERROR: Failures and exceptions
Request timeout: GET /calls - Failed after 30simport logging
from aircall import AircallClient
# Configure file logging
logging.basicConfig(
filename='aircall_api.log',
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
client = AircallClient(api_id="your_id", api_token="your_token")
import logging
from aircall import AircallClient
# Create custom logger with specific handler
logger = logging.getLogger('aircall')
logger.setLevel(logging.INFO)
# Add console handler
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
# Custom formatter
formatter = logging.Formatter(
'%(asctime)s [%(name)s] %(levelname)s: %(message)s'
)
handler.setFormatter(formatter)
logger.addHandler(handler)
client = AircallClient(api_id="your_id", api_token="your_token")
Each resource has its own logger namespace:
import logging
# Only show logs from the call resource
logging.getLogger('aircall.resources.CallResource').setLevel(logging.DEBUG)
# Disable logging for the contact resource
logging.getLogger('aircall.resources.ContactResource').setLevel(logging.CRITICAL)
With verbose=True or DEBUG level logging enabled:
2025-11-09 10:30:45 - aircall.client - INFO - Aircall client initialized
2025-11-09 10:30:46 - aircall.client - DEBUG - Request: GET https://api.aircall.io/v1/numbers
2025-11-09 10:30:46 - aircall.client - DEBUG - Query params: {'page': 1, 'per_page': 20}
2025-11-09 10:30:46 - aircall.client - DEBUG - Response: 200 GET https://api.aircall.io/v1/numbers (took 0.23s)
2025-11-09 10:30:47 - aircall.resources.CallResource - INFO - Transferring call 12345 to number 67890
2025-11-09 10:30:47 - aircall.client - DEBUG - Request: POST https://api.aircall.io/v1/calls/12345/transfers
2025-11-09 10:30:47 - aircall.client - DEBUG - Request body: {'number_id': 67890}
2025-11-09 10:30:48 - aircall.client - DEBUG - Response: 200 POST https://api.aircall.io/v1/calls/12345/transfers (took 0.45s)
2025-11-09 10:30:48 - aircall.resources.CallResource - INFO - Successfully transferred call 12345
INFO or WARNING level to avoid logging sensitive request/response dataDEBUG level or verbose=True for detailed troubleshootingWARNING level to track API errors and rate limitsThis project uses uv for dependency management.
# Clone the repository
git clone https://github.com/yourusername/aircall-api.git
cd aircall-api
# Install dependencies
uv sync
# Activate virtual environment
source .venv/bin/activate # Linux/Mac
# or
.venv\Scripts\activate # Windows
# Run tests
pytest
# Run tests with coverage
pytest --cov=aircall
# Run ruff for linting
ruff check .
# Run pylint
pylint src/aircall
aircall-api/
├── src/
│ └── aircall/
│ ├── __init__.py
│ ├── client.py # Main API client
│ ├── exceptions.py # Custom exceptions
│ ├── models/ # Pydantic models
│ │ ├── call.py
│ │ ├── contact.py
│ │ ├── user.py
│ │ └── ...
│ └── resources/ # API resource handlers
│ ├── base.py
│ ├── call.py
│ ├── contact.py
│ └── ...
├── tests/ # Test suite
├── pyproject.toml # Project configuration
└── README.md
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
FAQs
Python API Built to connect with aircall.io API Endpoints
We found that aircall-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.