Airbyte API Client
The `airbyte-api` library is the official Python client SDK for interacting with the Airbyte API. It provides programmatic access to manage connections, sources, destinations, and perform data synchronization operations. The current version is 0.53.0 and it is actively maintained with frequent updates reflecting the underlying Airbyte platform and API.
Warnings
- breaking The `airbyte-api` Python SDK is currently in beta. Breaking changes may occur in minor versions until the SDK reaches a stable v1.0.0 release. Always review the changelog before upgrading.
- gotcha Incorrect `bearer_auth` or `server_url` can lead to authentication failures or 'not found' errors. Ensure your API key is correct and the `server_url` points to the correct Airbyte API endpoint (e.g., `https://api.airbyte.com/v1` for Airbyte Cloud, or your self-hosted instance's URL).
- gotcha When making API calls, it's crucial to always check the `response.status_code` to ensure the call was successful and handle potential errors. Directly accessing `response.data` or similar attributes without checking status can lead to `AttributeError` if an error occurred and the expected data model is not present.
Install
-
pip install airbyte-api
Imports
- Airbyte
import airbyte_api
- shared
from airbyte_api.models import shared
Quickstart
import airbyte_api
import os
from airbyte_api.models import shared
# Initialize the Airbyte client
client = airbyte_api.Airbyte(
bearer_auth=os.environ.get('AIRBYTE_API_KEY', 'YOUR_API_KEY'),
server_url=os.environ.get('AIRBYTE_SERVER_URL', 'https://api.airbyte.com/v1')
)
# Example: List workspaces
try:
response = client.workspaces.list_workspaces()
if response.status_code == 200:
print("Successfully listed workspaces:")
for workspace in response.list_workspaces_response.data:
print(f"- ID: {workspace.workspace_id}, Name: {workspace.name}")
else:
print(f"Error listing workspaces: Status {response.status_code}")
if response.error_response:
print(f"Error details: {response.error_response.message}")
except Exception as e:
print(f"An unexpected error occurred: {e}")