GoHighLevel Python SDK - Official API client for GoHighLevel platform
Low maintenance activity. Last release 5 months ago, commits in 1 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install gohighlevel-api-clientGoHighLevel Python SDK
Official Python SDK for the GoHighLevel API. This library provides a convenient way to interact with GoHighLevel's APIs from applications written in Python.
Installation
# Install the SDK
pip install gohighlevel-api-client
Quick Start
Basic Usage
from highlevel import HighLevel
# Initialize with OAuth credentials
client = HighLevel(
client_id="your_client_id",
client_secret="your_client_secret"
)
OAuth Flow Example
import asyncio
from highlevel import HighLevel
async def oauth_example():
client = HighLevel(
client_id="your_client_id",
client_secret="your_client_secret"
)
# Step 1: Get authorization URL
auth_url = client.oauth.get_authorization_url(
client_id="your_client_id",
redirect_uri="https://your-app.com/callback",
scope="contacts.readonly campaigns.readonly"
)
print(f"Visit: {auth_url}")
# Step 2: Exchange code for tokens (after user authorization).
# The request body uses camelCase keys.
token_data = await client.oauth.get_access_token({
"clientId": "your_client_id",
"clientSecret": "your_client_secret",
"grantType": "authorization_code",
"code": "authorization_code_from_callback",
})
# token_data is the raw token response, with camelCase keys:
# accessToken, refreshToken, expiresIn, userType, and locationId or companyId.
# Persist it via your session storage to authenticate later requests.
print("OAuth flow completed successfully!")
asyncio.run(oauth_example())
Storage
It can be used to store the access and refresh token for your application.
MongoDB Storage
from highlevel import HighLevel
from highlevel.storage import MongoDBSessionStorage
storage = MongoDBSessionStorage(
connection_string="mongodb://localhost:27017",
database_name="ghl_sessions",
collection_name="jwt_tokens"
)
client = HighLevel(
client_id="your_client_id",
client_secret="your_client_secret",
session_storage=storage
)
Webhook Integration
The SDK provides comprehensive webhook support for handling GoHighLevel webhook events, including automatic token management and session storage integration.
Features
- Automatic Token Management: Handles
INSTALLandUNINSTALLwebhooks automatically - Token Storage: Generates and stores access tokens on
INSTALL, removes them on