ghl-sdk
Unofficial async Rust SDK for the GoHighLevel (HighLevel) API 2.0.
- Auth: Private Integration Tokens (
pit-…), raw OAuth access tokens, or full OAuth 2.0 with automatic refresh and pluggableTokenStores. Agency→location token exchange (Ghl::as_location) for multi-tenant work. - Resilience: retries with exponential backoff + jitter,
Retry-Aftersupport on 429s, idempotent-only retry on 5xx/transport errors, live rate-limit headroom viaGhl::rate_status(). - Pagination: GoHighLevel's cursor scheme handled for you, exposed as
Streams. - Config: builder parameters or environment variables (
GHL_PIT_TOKEN,GHL_ACCESS_TOKEN,GHL_BASE_URL) — explicit parameters always win. - Secret hygiene: tokens are
secrecytypes, redacted from allDebugoutput. - Forward-compatible types: unknown response fields are preserved in an
extramap instead of breaking deserialization.
use ;
use TryStreamExt;
async
Every endpoint is a typed method
1,203 generated methods — 576 in API v2, 627 in v3 — across all 45 modules. Enable the feature named after the module:
= { = "0.5", = ["invoices"] }
use ListInvoicesParams;
// Required query params are constructor args; optional ones are setters.
let params = new.status;
let page = ghl.invoices.list_invoices.await?; // typed response
One module compiles in a second or two; features = ["full"] (all 41) takes closer to a minute.
API v3 lives behind ghl.v3() and sends Version: v3 for you:
let dup = ghl.v3.contacts.get_duplicate_contact.await?;
v3 also has modules v2 doesn't: ad-publishing, social-planner, saas, chat-widget.
Webhooks
= { = "0.5", = ["webhooks"] }
GoHighLevel signs webhooks with RSA-SHA256 over the raw body. Verify the raw bytes, then parse:
verify?;
let event: WebhookEvent = from_slice?;
if event.is_stale // replay guard
match event.event_type
Strict on send, lenient on receive: request types keep the spec's required fields non-Option; response types make everything optional, because GoHighLevel sometimes omits fields its own spec marks required and a strict type would make that unrecoverable.
Docs: usage guide · full API reference (all 45 modules, every endpoint/struct/enum).
Looking for the AI-agent side? See ghl-mcp, the MCP server built on this SDK.
License: MIT or Apache-2.0. Not affiliated with HighLevel Inc.