
Client
The Client class is the main entry point for the OmniDimension SDK. It handles authentication, request management, and provides access to all API domains.
Initialization
To use the OmniDimension SDK, you first need to initialize the Client with your API key:
1
2
3
4
5
6
import os
from omnidimension import Client
# Initialize with default production URL
api_key = os.environ.get('OMNIDIM_API_KEY', 'your_api_key_here')
client = Client(api_key)
Important
Always keep your API key secure and never expose it in client-side code.
Client Structure
The Client object provides access to different domains of the OmniDimension API through dedicated properties:
1
2
3
4
5
client.agent # Agent operations
client.call # Call operations
client.integrations # Integration operations
client.knowledge_base # Knowledge base operations
client.phone_number # Phone number operations
Knowledge Base
Upload, manage, and attach knowledge base files to agents.
View Knowledge Base documentation →Error Handling
The SDK provides an APIError class to handle API-specific errors. Here's how to use it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os
from omnidimension import Client, APIError
api_key = os.environ.get('OMNIDIM_API_KEY', 'your_api_key_here')
client = Client(api_key)
try:
# Make an API request
response = client.agent.list()
print(response)
except APIError as e:
print(f"API Error ({e.status_code}): {e.message}")
except Exception as e:
print(f"Unexpected error: {str(e)}")
Client Parameters
Parameter | Type | Required | Description |
---|---|---|---|
api_key | string | Yes | Your OmniDimension API key for authentication |
base_url | string | No | The base URL for the API. Defaults to the production URL. |