# gohighlevel/highlevel-api-sdk architecture

> Architecture diagram of the GitHub repository gohighlevel/highlevel-api-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gohighlevel/highlevel-api-sdk
- Repository: https://github.com/gohighlevel/highlevel-api-sdk

## Overview

This is the official HighLevel TypeScript API SDK. A consumer configures `HighLevel`, then uses its endpoint services to make authenticated API requests; OAuth sessions, token refresh, rate-limit handling, and webhooks support that workflow. The tree and index show broad endpoint coverage, while excerpts confirm request construction and token-provider behavior. Several endpoint families are represented by their exact enclosing directories because their implementations were not sampled; edges are limited to documented or indexed references.

Main entry points: [`lib/HighLevel.ts`](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/HighLevel.ts) (HighLevel client), [`lib/utils/request-utils.ts`](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/utils/request-utils.ts) (Token provider), [`lib/storage/session-storage.ts`](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/storage/session-storage.ts) (Session storage contract), [`lib/code/contacts/contacts.ts`](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/contacts/contacts.ts) (Contacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["SDK client"]
  node_highlevel["HighLevel client<br/>[HighLevel.ts]"]
end

subgraph group_endpoints["API endpoint services"]
  node_contacts["Contacts<br/>[contacts.ts]"]
  node_conversations["Conversations<br/>[conversations.ts]"]
  node_calendars["Calendars<br/>[calendars.ts]"]
  node_invoices["Invoices<br/>[invoices.ts]"]
  node_payments["Payments<br/>[payments.ts]"]
  node_products["Products<br/>[products.ts]"]
  node_marketing["Marketing tools"]
  node_admanager["Ad manager<br/>[ad-manager.ts]"]
  node_saas["SaaS API<br/>[saas-api.ts]"]
  node_otherdomains["Other API domains"]
end

subgraph group_auth["Auth and sessions"]
  node_oauth["OAuth service<br/>[oauth.ts]"]
  node_webhooks["Webhook manager<br/>[webhook-manager.ts]"]
  node_sessionbase["Session storage contract<br/>[session-storage.ts]"]
  node_memory["Memory sessions"]
  node_mongodb[("MongoDB sessions")]
end

subgraph group_support["Request support"]
  node_tokenprovider["Token provider<br/>[request-utils.ts]"]
  node_ratelimits["Rate-limit handling<br/>[rate-limit.ts]"]
  node_errors["Error handling<br/>[errors.ts]"]
  node_logging["Logging<br/>[logger.ts]"]
end

node_consumer(("SDK consumer"))
node_api(("HighLevel API"))

node_consumer -->|"configures and calls"| node_highlevel
node_highlevel -->|"references service"| node_contacts
node_highlevel -->|"references service"| node_conversations
node_highlevel -->|"references service"| node_calendars
node_highlevel -->|"references service"| node_invoices
node_highlevel -->|"references service"| node_payments
node_highlevel -->|"references service"| node_products
node_highlevel -->|"references service"| node_marketing
node_highlevel -->|"references service"| node_admanager
node_highlevel -->|"references service"| node_saas
node_highlevel -->|"references endpoint modules"| node_otherdomains
node_contacts -->|"imports and uses"| node_tokenprovider
node_conversations -->|"imports and uses"| node_tokenprovider
node_calendars -->|"imports and uses"| node_tokenprovider
node_invoices -->|"imports and uses"| node_tokenprovider
node_payments -->|"imports and uses"| node_tokenprovider
node_products -->|"imports and uses"| node_tokenprovider
node_marketing -->|"imports and uses"| node_tokenprovider
node_admanager -->|"gets auth token"| node_tokenprovider
node_saas -->|"imports and uses"| node_tokenprovider
node_oauth -->|"imports and uses"| node_tokenprovider
node_highlevel -.->|"configures token storage"| node_sessionbase
node_memory -->|"extends contract"| node_sessionbase
node_mongodb -->|"extends contract"| node_sessionbase
node_webhooks -->|"reads access token"| node_sessionbase
node_highlevel -->|"parses retry headers"| node_ratelimits
node_highlevel -->|"creates API errors"| node_errors
node_highlevel -.->|"sends API requests"| node_api

click node_highlevel "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/HighLevel.ts"
click node_contacts "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/contacts/contacts.ts"
click node_conversations "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/conversations/conversations.ts"
click node_calendars "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/calendars/calendars.ts"
click node_invoices "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/invoices/invoices.ts"
click node_payments "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/payments/payments.ts"
click node_products "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/products/products.ts"
click node_marketing "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/social-media-posting/social-media-posting.ts"
click node_admanager "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/ad-manager/ad-manager.ts"
click node_saas "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/saas-api/saas-api.ts"
click node_otherdomains "https://github.com/gohighlevel/highlevel-api-sdk/tree/main/lib/code"
click node_oauth "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/oauth/oauth.ts"
click node_webhooks "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/webhook/webhook-manager.ts"
click node_sessionbase "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/storage/session-storage.ts"
click node_memory "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/storage/memory-session-storage.ts"
click node_mongodb "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/storage/mongodb-session-storage.ts"
click node_tokenprovider "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/utils/request-utils.ts"
click node_ratelimits "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/utils/rate-limit.ts"
click node_errors "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/errors.ts"
click node_logging "https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/logging/logger.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_highlevel toneBlue
class node_contacts,node_conversations,node_calendars,node_invoices,node_payments,node_products,node_marketing,node_admanager,node_saas,node_otherdomains toneAmber
class node_oauth,node_webhooks,node_sessionbase,node_memory,node_mongodb,node_api toneMint
class node_tokenprovider,node_ratelimits,node_errors,node_logging toneRose
class node_consumer toneIndigo
```

## Components

### SDK client

- [HighLevel client](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/HighLevel.ts): `lib/HighLevel.ts`

### API endpoint services

- [Contacts](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/contacts/contacts.ts): `lib/code/contacts/contacts.ts`
- [Conversations](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/conversations/conversations.ts): `lib/code/conversations/conversations.ts`
- [Calendars](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/calendars/calendars.ts): `lib/code/calendars/calendars.ts`
- [Invoices](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/invoices/invoices.ts): `lib/code/invoices/invoices.ts`
- [Payments](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/payments/payments.ts): `lib/code/payments/payments.ts`
- [Products](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/products/products.ts): `lib/code/products/products.ts`
- [Marketing tools](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/social-media-posting/social-media-posting.ts): `lib/code/social-media-posting/social-media-posting.ts`
- [Ad manager](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/ad-manager/ad-manager.ts): `lib/code/ad-manager/ad-manager.ts`
- [SaaS API](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/saas-api/saas-api.ts): `lib/code/saas-api/saas-api.ts`
- [Other API domains](https://github.com/gohighlevel/highlevel-api-sdk/tree/main/lib/code): `lib/code`

### Auth and sessions

- [OAuth service](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/code/oauth/oauth.ts): `lib/code/oauth/oauth.ts`
- [Webhook manager](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/webhook/webhook-manager.ts): `lib/webhook/webhook-manager.ts`
- [Session storage contract](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/storage/session-storage.ts): `lib/storage/session-storage.ts`
- [Memory sessions](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/storage/memory-session-storage.ts): `lib/storage/memory-session-storage.ts`
- [MongoDB sessions](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/storage/mongodb-session-storage.ts): `lib/storage/mongodb-session-storage.ts`

### Request support

- [Token provider](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/utils/request-utils.ts): `lib/utils/request-utils.ts`
- [Rate-limit handling](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/utils/rate-limit.ts): `lib/utils/rate-limit.ts`
- [Error handling](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/errors.ts): `lib/errors.ts`
- [Logging](https://github.com/gohighlevel/highlevel-api-sdk/blob/main/lib/logging/logger.ts): `lib/logging/logger.ts`

### Other components

- **SDK consumer**
- **HighLevel API**

## Connections

- SDK consumer → HighLevel client: configures and calls
- HighLevel client → Contacts: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Conversations: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Calendars: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Invoices: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Payments: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Products: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Marketing tools: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Ad manager: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → SaaS API: references service (evidence: `lib/HighLevel.ts`)
- HighLevel client → Other API domains: references endpoint modules (evidence: `lib/HighLevel.ts`)
- Contacts → Token provider: imports and uses (evidence: `lib/code/contacts/contacts.ts`)
- Conversations → Token provider: imports and uses (evidence: `lib/code/conversations/conversations.ts`)
- Calendars → Token provider: imports and uses (evidence: `lib/code/calendars/calendars.ts`)
- Invoices → Token provider: imports and uses (evidence: `lib/code/invoices/invoices.ts`)
- Payments → Token provider: imports and uses (evidence: `lib/code/payments/payments.ts`)
- Products → Token provider: imports and uses (evidence: `lib/code/products/products.ts`)
- Marketing tools → Token provider: imports and uses (evidence: `lib/code/social-media-posting/social-media-posting.ts`)
- Ad manager → Token provider: gets auth token (evidence: `lib/code/ad-manager/ad-manager.ts`)
- SaaS API → Token provider: imports and uses (evidence: `lib/code/saas-api/saas-api.ts`)
- OAuth service → Token provider: imports and uses (evidence: `lib/code/oauth/oauth.ts`)
- HighLevel client → Session storage contract: configures token storage
- Memory sessions → Session storage contract: extends contract (evidence: `lib/storage/memory-session-storage.ts`)
- MongoDB sessions → Session storage contract: extends contract (evidence: `lib/storage/mongodb-session-storage.ts`)
- Webhook manager → Session storage contract: reads access token (evidence: `lib/webhook/webhook-manager.ts`)
- HighLevel client → Rate-limit handling: parses retry headers (evidence: `lib/HighLevel.ts`)
- HighLevel client → Error handling: creates API errors (evidence: `lib/HighLevel.ts`)
- HighLevel client → HighLevel API: sends API requests
