Infobip
Official Python client for Infobip communications APIs (SMS, WhatsApp, Email, Voice). Current version is 6.0.0 (Jan 2026). Requires Python >=3.9. Auto-generated from OpenAPI spec — every major version contains breaking changes. Requires account-specific base URL (not a generic endpoint). Two separate packages exist: the official infobip-api-python-client and the community infobip-api-python-sdk.
Common errors
-
ModuleNotFoundError: No module named 'infobip_api_client'
cause The `infobip-api-python-client` package is either not installed, or there's a typo in the import statement, or developers might be trying to import from the incorrect package (e.g., confusing it with `infobip-api-python-sdk`).fixEnsure the correct package is installed using `pip install infobip-api-python-client` and verify that import statements correctly reference `infobip_api_client` (e.g., `from infobip_api_client.api_client import ApiClient`). -
NameError: name 'InfobipApiClient' is not defined
cause This error typically occurs when the `ApiClient` class is imported without aliasing it as `InfobipApiClient`, or the alias is misspelled, preventing the code from recognizing the name.fixCorrectly import and alias the `ApiClient` class using `from infobip_api_client.api_client import ApiClient as InfobipApiClient`. -
ValueError: Missing required parameter `host` or `api_key` when initializing Configuration.
cause The `Configuration` object, essential for client setup, requires both a specific `host` (your Infobip base URL) and an `api_key` for authentication, and these were not provided during initialization.fixInitialize the `Configuration` object with your account-specific `host` (base URL) and `api_key` from your Infobip account, for example: `client_config = Configuration(host="<YOUR_BASE_URL>", api_key="<YOUR_API_KEY>")`. -
ValueError: Host URL must be HTTPS.
cause Starting with version 6.0.0, the `infobip-api-python-client` library strictly enforces the use of HTTPS for the API host URL, and explicitly providing an `http://` URL will raise this error.fixUpdate your host URL to use `https://` instead of `http://` (e.g., `https://<YOUR_BASE_URL>`). The SDK will automatically prefix URLs without a protocol with `https://`. -
AttributeError: 'Configuration' object has no attribute 'api_key_prefix'
cause This `AttributeError` is a common symptom of breaking changes introduced in version 6.0.0 of the library, specifically the deprecation and removal of the `api_key_prefix` attribute from the `Configuration` object.fixRemove the `api_key_prefix` parameter from your `Configuration` initialization, as it is no longer required or supported when providing the `api_key` and `host` directly.
Warnings
- breaking Every major version of infobip-api-python-client contains breaking changes. The library is auto-generated from OpenAPI spec — model names, method signatures, and endpoint paths change between versions. Code written for v3 will not work on v5 or v6.
- breaking Account-specific base URL is required. Using a generic URL like https://api.infobip.com causes authentication failures. Each Infobip account has a unique subdomain assigned at account creation.
- breaking SMS API endpoint changed: /sms/3/messages (V3) replaced /sms/2/text/advanced (V2) in v5.x. Email API /email/4/messages (V4) replaced /email/3/send (V3). Old endpoint paths and corresponding SDK methods are removed.
- breaking Python 3.8 support dropped in v6.0. Minimum is now Python 3.9.
- breaking HTTPS enforcement added in v6.0. Passing http:// as the host URL now raises ValueError at configuration time.
- gotcha Two separate packages exist: infobip-api-python-client (official, auto-generated, breaking changes each major) and infobip-api-python-sdk (community, different API style, last updated 2023). They have different import patterns and are not interchangeable.
- breaking infobip-api-python-client v6.0.0+ requires Pydantic v2.x. An 'ImportError: cannot import name 'validate_call' from 'pydantic'' will occur if Pydantic v1.x is present in the environment.
- breaking Some transitive dependencies of infobip-api-python-client (e.g., 'regex') require system build tools like 'gcc' to compile C extensions during installation. This commonly occurs in minimal environments like Alpine Linux, leading to a build failure.
Install
-
pip install infobip-api-python-client -
pip install infobip-api-python-sdk
Imports
- infobip_api_client
# Using generic Infobip URL instead of account-specific URL: configuration = Configuration( host='https://api.infobip.com' # wrong — fails auth )from infobip_api_client.api.sms_api import SmsApi from infobip_api_client.api_client import ApiClient, Configuration from infobip_api_client.models import SmsAdvancedTextualRequest, SmsDestination, SmsTextualMessage # Account-specific base URL required — not a generic URL configuration = Configuration( host='https://ACCOUNT_BASE_URL.api.infobip.com', # from Infobip dashboard api_key={'APIKeyHeader': 'App YOUR_API_KEY'} ) with ApiClient(configuration) as api_client: api_instance = SmsApi(api_client) request = SmsAdvancedTextualRequest( messages=[SmsTextualMessage( destinations=[SmsDestination(to='+14155551234')], from_='InfoSMS', text='Hello World!' )] ) response = api_instance.send_sms_message(sms_advanced_textual_request=request)
Quickstart
from infobip_api_client.api.sms_api import SmsApi
from infobip_api_client.api_client import ApiClient, Configuration
from infobip_api_client.models import (
SmsAdvancedTextualRequest,
SmsDestination,
SmsTextualMessage
)
# Get base_url from: app.infobip.com → API Keys
configuration = Configuration(
host='https://XXXXX.api.infobip.com',
api_key={'APIKeyHeader': 'App YOUR_API_KEY'}
)
with ApiClient(configuration) as api_client:
sms_api = SmsApi(api_client)
request = SmsAdvancedTextualRequest(
messages=[
SmsTextualMessage(
destinations=[SmsDestination(to='+14155551234')],
from_='InfoSMS',
text='Hello from Infobip!'
)
]
)
response = sms_api.send_sms_message(
sms_advanced_textual_request=request
)
print(response.messages[0].message_id)